When the client application has printed something to the last column,
the cursor remains in that last column, but the LCF flag is set. The
next time something is printed, we linewrap.
This needs special consideration both when an OSC-8 URL is started,
and closed, when LCF is set.
Before this patch, emitting an OSC-8 URL while the cursor was in the
last column (with LCF set) would incorrectly include the last
character from that line, when the URL really should start at the next
line.
Furthermore, ending an OSC-8 URL with LCF set would inorrectly exclude
the last character.
This patch fixes this by using the will-be-printed-to
coordinates (i.e. the next line) in the OSC-8 start/end coordinates.
Note that this means that we _can_ point to uninitialized grid
data (i.e. to a NULL-row). This should be ok though, since either
something *will* be printed to that row before the URL is closed, or
a cursor movement causes the URL to be closed while still being empty,
which is a no-op.
Use runtime switchable function pointers for cursor movement
functions. The “normal” once are not OSC-8 aware, while the *_osc8
are.
OSC-8 aware means the cursor movement functions will “close” the
currently open URL before moving the cursor, and then re-open the URL
after having moved the cursor.
This simulates SGR-like behavior for OSC-8 URLs; the URL “property” is
only assigned to cells that are actually printed to.
Closes#816
If a mouse selection was ongoing, and the user switched
workspace (probably using the keyboard...), and then back, the
selection was still treated as ongoing, while all other mouse state
has been reset.
This meant the user had to tap at least once to stop the selection.
The old algorithm always created a new URI, followed by (maybe)
removing the existing URI, when an URI needed to be modified.
That is, if e.g. the tail of an URI was being erased, the old
algorithm would create a new URI for the part of the URI that should
remain, and then removed the old URI.
This isn’t very effective. The new algorithm instead identifies all
possible overlap cases, and handles each one differently:
* URI ends *before* erase range starts - continue with the next URI
without further checks
* URI starts *after* the erase range ends - return, we’re done
* Erase range erases the entire URI - remove the URI
* Erase range erases a part in the middle - split the URI
* Erase range erases the head of the URI - adjust the URI’s start
* Erase range erases the tail of the URI - adjust the URI’s end
This function handles erasing of an URI range. That is, a range of the
row is being either erased, or overwritten (from the URI perspective,
these two are the same thing).
We handle both partial overwrites (split up, or truncate URI), as well
as complete overwrites (remove URI).
Instead of passing raw char** pointers to argv_compare(), pass
pointers to ‘struct argv’.
This lets argv_compare() handle both argv’s being NULL, or one of them
being NULL. That is, the caller no longer needs to check that both
argv’s are non-NULL before calling argv_compare().
Furthermore, update has_key_binding_collisions() to require the pipe
argv to match, in addition to matching the ‘action’, when allowing a
key collision.
When parsing a key binding with a pipe-argv, we failed to free the
argv vector (or to be precise, the strdup:ed entries in the array)
when failing to parse the remainder of the binding.
The parsing context keeps a pointer to the current section name. This
is used when logging errors.
However, the pointer was into a buffer allocated by getline(). This
buffer are often re-used in the next call to getline(), or free:d.
Regardless, the section name pointer is invalid after the next call to
getline(), which meant all error messages were logging a correct
section name.
Each cell now tracks it’s current color source:
* default fg/bg
* base16 fg/bg (maps to *both* the regular and bright colors)
* base256 fg/bg
* RGB
Note that we don’t have enough bits to separate the regular from the
bright colors. These _shouldn’t_ be the same, so we ought to be
fine...
The maximum size required for the string buffer is relatively small,
known at compile-time and not likely to ever grow beyond 512 bytes.
Therefore we may as well just use the stack.
This could be triggered by running, for example:
foot -o tweak.render-timer=invalid
For some reason LeakSanitizer was only detecting this leak when the
option value was invalid, even though it was occuring in either case.
Every branch of these long if/else if/else chains returns, so the
compiler can figure out on its own that the last line is never reached.
If, for some reason, one of the branches does not return (as was the
case after 205f1f7, fixed by b22322b), this would usually result in a compiler
error ("control reaches end of non-void function"), but adding UNREACHABLE
transforms this into silent undefined behaviour.
The missing return caused us to fall through to the bottom of the
function, where we ended with an error message:
[main].letter-spacing: 0: not a valid option: letter-spacing
Closes#795
This adds a new meson option that controls whether the example theme
files should be installed or not. The default is true.
Previously, themes were gated by the -Ddocs option.