| Commit message (Collapse) | Author | Age | Lines |
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Remove assertion that row be less than the scrolling region end. The
cursor may in fact be *inside* the margin.
Inside the margin, content never scrolls, but we must make sure we
don't move the cursor outside the grid.
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| | |
If not -1, spawn() will redirect the child's stdin/stdout/stderr to
these FDs.
|
| | | |
|
| |/
|
|
|
| |
These functions extract the current view, or the entire scrollback as
an UTF-8 encoded byte buffer.
|
| | |
|
| |
|
|
|
| |
And refactor: break out spacer-writing code to a function, since we do
exactly the same thing in two places.
|
| |
|
|
| |
Otherwise we end up overwriting the character in the last column
|
| |
|
|
|
|
| |
When printing a multi-column character, write CELL_MULT_COL_SPACER
instead of '0' to both padding cells (when character doesn't fit at
the end of the line), and to the cells following the actual character.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When printing a multi-column character at the end of the line, and it
doesn't fit, we currently insert a forced line-wrap. This means the
last character(s) on the previous line will be empty, followed by a
multi-column character in the first cell on the next line.
Without special code to handle this, the selection text extraction
code will insert a hard newline, since this is normally the correct
thing to do.
Add a TODO, to consider writing a special place holder value to these
padding cells.
|
| | |
|
| |
|
|
|
| |
We know we're within bounds, and thus we don't need the extra overhead
of term_cursor_right().
|
| | |
|
| |
|
|
|
|
| |
While this might seem like it would slow down things, it should in
fact help the compiler optimize: the "normal" code path, that prints
regular ASCII characters, always call term_print() with width == 1.
|
| |
|
|
|
| |
line-wrap is in the hot path, and term_cursor_down/left adds
additional checks that we don't need.
|
| | |
|
| |
|
|
|
| |
There's nothing wrong with using term_cursor_right(), but it is
unnecessary since we already check for the end-of-line.
|
| | |
|
| |
|
|
|
|
| |
LF should always clear LCF. Previously, it was done implicitly in
term_cursor_down(). I.e it was cleared as long as the cursor wasn't at
the bottom of the scrolling region
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of locking the queue for each dirty row we append, and
signaling a condition variable, just keep the lock while going through
the visible rows.
Release the lock once done.
Since we take the lock *before* posting the 'start' semaphore, all
workers will be waiting for the lock to be released.
Then, one at a time they'll get the lock and pick a row to
render. The queue will never get empty - when all rows have been
rendered, each worker will pick a 'frame done' "job" from the queue,
and break the rendering loop.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
There's one difference however, when we receive a kbd unfocus call,
*all* seats must have us unfocused before we actually change the
state.
|
| |
|
|
|
|
|
|
| |
* xcursor always set for all pointers
* xcursor sometimes not updated when it should be
* mouse grabbed state wasn't per seat, but global (i.e. "does at least
one seat enable mouse grabbing")
* selection enabled state wasn't per seat
|
| | |
|
| |
|
|
|
|
| |
That is, only call term_kbd_focus_in() if we're the *first* seat
focusing that terminal, and only call term_kbd_focus_out() if we're
the *last* seat that focused it.
|
| | |
|
| | |
|
| |
|
|
|
| |
Compiles and runs, but mouse, clipboard and other things have been
disabled.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When resizing the font on-the-fly, we now do a complete
font-reload (this is basically what fcft_size_adjust() did anyway).
To get the correct size, we maintain the current size ourselves.
We get the initial size from the user-provided font pattern, by
converting the string to an FcPattern, and using FcPatternGet() to
retrieve both the FC_SIZE and FC_PIXEL_SIZE attributes. These
attributes are then removed from the pattern, and the pattern is
converted back to a string.
The terminal struct maintains a copy of the font sizes. These are
initially set to the sizes from the config.
When the user resizes the font, the terminal-local sizes are
adjusted. To ensure the primary and user-configured fallback fonts are
resizes equally much, convert any pixel sizes to point sizes at this
point.
When the font size is reset, we reload the font sizes from the
config (thus once again returning actual pixel-sizes, if that's what
the user has configured).
|
| |
|
|
|
| |
This option controls whether the default cursor should blink or
not. The default is to *not* blink.
|
| |\ |
|
| | |
| |
| |
| |
| |
| | |
If changing the font size causes the cell size to decrease, either
horizontally or vertically (or both), then delete all sixels since the
grid space they allocated no longer is enough to hold the images.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The logic that breaks out of sixel loops does not work for rows that
has already wrapped around.
Thus, we need to destroy sixels that are about to be scrolled
out *before* we actually scroll.
Since this is the *only* time we destroy sixels (instead of
overwriting it), rename the sixel functions. And, since they now do a
very specific thing, they can be greatly simplified (and thus faster).
|
| |/
|
|
| |
This is necessary to handle multi-column characters correctly.
|
| | |
|
| | |
|
| |
|
|
| |
Avoid unnecessary wrap checks if the sixel image list is empty.
|
| |
|
|
|
|
|
|
|
|
| |
Instead of completely erasing a sixel image when it is being
"overwritten" (text is printed somewhere within the image, or another
sixel image is emitted within the first image), split it up into up to
four pieces: 'above', 'below', 'to-the-left' and 'to-the-right'.
This is currently very un-optimized, but seems to produce correct
results.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
A client can re-use the palette between images. Resetting the palette
breaks this.
Now we initialize the palette on demand, and resets it when the
palette size is changed (by the client).
|
| | |
|
| |
|
|
|
|
|
|
| |
Since foot is pretty aggressive about spawning the client early, it
was possible for a fast client to read a 0x0 terminal size. Not all
clients coped well.
Closes #20.
|
| |
|
|
|
| |
Instead, register their PIDs with the new reaper module and let it
handle them.
|
| |
|
|
|
| |
When the viewport wraps around, the selection points may be
"incorrect".
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When scrolling, there are a couple of cases where an existing
selection must be canceled because we cannot meaningfully represent it
after scrolling.
These are when the selection is (partly) inside:
* The top scrolling region
* The bottom scrolling region
* The new lines scrolled in. I.e. re-used lines
For the scrolling regions, the real problem is when the selection
crosses the scrolling region boundary; a selection that is completely
inside a scrolling regions _might_ be possible to keep, but we would
need to translate the selection coordinates to the new scrolling
region lines.
For simplicity, we cancel the selection if it touches the scrolling
region. Period.
The last item, newly scrolled in lines is when the selection covers
very old lines and we're now wrapping around the scrollback history.
Then there's a fourth problem case: when the user has started a
selection, but hasn't yet moved the cursor. In this case, we have no
end point.
What's more problematic is that when the user (after scrolling) moves
the cursor, we try to create a huge selection that covers mostly
empty (NULL) rows, causing us to crash.
This can happen e.g. when reverse scrolling in such a way that we wrap
around the scrollback history.
The actual viewport in this case is something like `-n - m`. But the
selection we'll end up trying to create will be `m - (rows - n)`. This
range may very well contain NULL rows.
To deal with this, we simply cancel the selection.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
We normally don't clear the selection when scrolling. The exception is
when the selection covers re-used rows. I.e. rows that we scroll in
and clear.
In this case we cancel the selection (we _could_ modify it and keep as
much as possible and only remove the re-used rows...). We must do
this *before* scrolling, since scrolling will swap rows (when there's
a scrolling region). When this happens, the selection is "corrupted",
and canceling it afterwards will not work.
|
| |
|
|
|
| |
This allows us to check the selection once when scrolling, instead of
once for each scrolled in line.
|
| |
|
|
|
|
|
| |
This reverts commit 8448296bb3c0fa96f5af5cb7ec563bb0c7e99093.
Applications need to be multi-column character aware anyway, and they
should deal with this.
|
| | |
|
| |
|
|
|
| |
This can happen when there's an error instantiating the
terminal *after* we've spawned the slave process.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
* Detect thrd_create() failures in all places where we instantiate
threads
* Log error correctl; thrd_create() does not return an errno value
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of storing combining data per cell, realize that most
combinations are re-occurring and that there's lots of available space
left in the unicode range, and store seen base+combining combinations
chains in a per-terminal array.
When we encounter a combining character, we first try to pre-compose,
like before. If that fails, we then search for the current
base+combining combo in the list of previously seen combinations. If
not found there either, we allocate a new combo and add it to the
list. Regardless, the result is an index into this array. We store
this index, offsetted by COMB_CHARS_LO=0x40000000ul in the cell.
When rendering, we need to check if the cell character is a plain
character, or if it's a composed character (identified by checking if
the cell character is >= COMB_CHARS_LO).
Then we render the grapheme pretty much like before.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
We only used utf8proc to try to pre-compose a glyph from a base and
combining character.
We can do this ourselves by using a pre-compiled table of valid
pre-compositions. This table isn't _that_ big, and binary searching it
is fast.
That is, for a very small amount of code, and not too much extra RO
data, we can get rid of the utf8proc dependency.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is basically just a loop that renders additional glyphs on top
off the base glyph.
Since we now need access to the row struct, for the combining
characters, the function prototype for 'render_cell()' has changed.
When rendering the combining characters we also need to deal with
broken fonts; some fonts use positive offsets (as if the combining
character was a regular character), while others use a negative
offset (to be used as if you had already advanced the pen position).
We handle both - a positive offset is rendered just like a regular
glyph. When we see a negative offset we simply add the width of a cell
first.
|
| |
|
|
|
|
|
|
|
|
|
| |
This is the *only* place combining characters are reset. In
particular, we do *not* reset them in a normal cell erase.
This is a performance design decision - clearing the combining
characters in erase is way too slow.
This way, we clear it only when we *have* to. Anything looking at the
combining characters must first ensure the base character is not 0.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The way things works right now, we cannot enable the ptmx FDM callback
right away. We need to wait for the Wayland window to have been
configured.
Before the window is configured, we don't have a size, and no
grid. Thus, if we try to process ptmx data we'll crash since we have
no where to write it to.
So, registering the ptmx fd with the FDM is now delayed until we've
received the first 'configure' event from Wayland.
|
| |
|
|
|
| |
This allows the client to load in parallel with our font loading,
which should improve startup time.
|
| | |
|
| |
|
|
|
| |
We sort of already did this. However, we did not handle the case where
the thread array itself hadn't yet been allocated.
|
| |
|
|
|
|
| |
This ensures the resources (e.g. stack) used by the transient threads
used to load the primary fonts can be re-used by the rendering worker
threads.
|
| |
|
|
|
|
|
|
| |
Use four threads to load the four primary font variants - normal,
bold, italic and bold italic.
This speeds up initial startup, and reloading of fonts on a DPI
change.
|
| |
|
|
| |
There is no other types of damage but scroll damage.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
At this point, we're not mapped, but we should have all the outputs
initialized. Which means we can at least guess which subpixel mode to
use.
If that turns out to be wrong, something we'll detect when we're
mapped, we'll just have to re-render.
|
| |
|
|
|
|
|
| |
* font_*() -> fcft_*()
* struct font -> struct fcft_font
* struct glyph -> struct fcft_glyph
* enum subpixel_order -> enum fcft_subpixel
|
| | |
|
| |
|
|
|
|
|
|
|
| |
These lists are typically empty when we destroy the terminal. However,
if we had queued up damage, and then manage to destroy the terminal
instance before the last changes were rendered, then they will *not*
be empty.
Found by the address sanitizer.
|
| |
|
|
|
| |
This way, the 'normal' and 'alt' grids have their own cursor state,
and we don't need to switch between them.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
In reset, we allocated new rows for all the currently visible
lines. We did **not** however, free the 'old' rows.
Fix by not explicitly allocating new rows, but instead allocating
uninitialized rows when needed, and then explicitly erasing the row.
If there already was a row allocated, it is simply erased. If there
wasn't, the a new line is malloc:ed, and then erased.
|
| | |
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
We now create a copy of the config for each client, and updates it
with the values passed from the client.
Since we're not actually cloning it (and e.g. strdup() all strings
etc) we can't call conf_destroy() to free it, but need to free just
the strings we've replaced.
|
| | |
| |
| |
| |
| | |
This option controls the initial window mode: windowed, maximized or
fullscreen. The default is windowed.
|
| | | |
|
| |/
|
|
| |
Synchronize window title updates with window rendering.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before, we applied delayed rendering (that is, we gave the client a
chance to do more writes before we scheduled a render refresh) only
when the renderer were idle.
However, with e.g. a high keyboard repeat rate, it is very much
possible to start the render loop and then never break out of it while
receiving keyboard input.
This causes screen flickering, as we're no longer even trying to
detect the clients transaction boundaries.
So, let's rewrite how this is done.
First, we give the user the ability to disable delayed rendering
altogether, by setting either the lower or upper timeout to 0.
Second, when delayed rendering is enabled, we ignore the frame
callback. That is, when receiving input, we *always* reschedule the
lower timeout timer, regardless of whether the render is idle or not.
The render's frame callback handler will *not* render the grid if the
delayed render timers are armed.
This means for longer client data bursts, we may now skip frames. That
is, we're trading screen flicker for the occasional frame hickup.
For short client data bursts we should behave roughly as before.
This greatly improves the behavior of fullscreen, or near fullscreen,
updates of large grids (example, scrolling in emacs in fullscreen,
with a vertical buffer split).
|
| |
|
|
|
|
|
|
|
| |
There's a race/chance that we'll have disarmed the delayed rendering
timers and still get the call.
While it _shouldn't_ be anything to read from the timers, it doesn't
hurt to try. And, if the timers *are* readable, not reading them means
we'll end up in an infinite FDM loop.
|