Commit graph

4964 commits

Author SHA1 Message Date
Daniel Eklöf
b1043a72f8
ci: fcft:text-shaping -> fcft:grapheme-shaping + fcft:run-shaping 2021-11-26 20:08:45 +01:00
Daniel Eklöf
a2d3a04ce7
Merge branch 'osc8-more-sgr-like' 2021-11-26 19:53:37 +01:00
Daniel Eklöf
8c50a7afd4
osc8: update URI ranges as we print data, *not* when the URI is closed
At first, an OSC-8 URI range was added when we received the closing
OSC-8 escape (i.e. with an empty URI).

But, this meant that cursor movements while the OSC-8 escape was in
effect wasn’t handled correctly, since we’d add a range that spanned
the cursor movements.

Attempts were made to handle this in the cursor movement functions, by
closing and re-opening the URI.

However, there are too many corner cases to make this a viable
approach. Scrolling is one such example, line-wrapping another.

This patch takes a different approach; emit, or update the URI range
when we print to the grid. This models the intended behavior much more
closely, where an active OSC-8 URI act like any other SGR attribute -
it is applied to all cells printed to, but otherwise have no effect.

To avoid killing performance, this is only done in the “generic”
printer. This means OSC-8 open/close calls must now “switch” the ASCII
printer.

Note that the “fast” printer still needs to *erase* pre-existing OSC-8
URIs.

Closes #816
2021-11-25 19:31:03 +01:00
Daniel Eklöf
82219713cc
Merge branch 'finalize-selection-on-pointer-leave' 2021-11-25 16:53:33 +01:00
Daniel Eklöf
325ad6dd4e
input: finalize mouse selection on a pointer-leave event on the GRID surface
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.
2021-11-25 15:21:53 +01:00
Daniel Eklöf
2eef28590a
Merge branch 'grapheme-width-max' 2021-11-25 12:44:35 +01:00
Daniel Eklöf
c1c0f11821
config: add tweak.grapheme-width-method=max
‘max’ is a new value for ‘tweak.grapheme-width-method’. When enabled,
the width of a grapheme cluster is that of the cluster’s widest
codepoint.
2021-11-23 19:50:05 +01:00
Daniel Eklöf
caec64cbda
changelog: add new ‘unreleased’ section 2021-11-22 22:24:13 +01:00
Daniel Eklöf
8b979e9dba
changelog: add #801 to “OSC-8 data not being cleared...” 2021-11-22 22:23:28 +01:00
Daniel Eklöf
72e1c7713e
Merge branch 'releases/1.10' 2021-11-22 22:23:09 +01:00
Daniel Eklöf
5eded7292c
meson: bump version to 1.10.1 2021-11-22 22:01:28 +01:00
Daniel Eklöf
f91dc5dd00
changelog: prepare for 1.10.1 2021-11-22 21:56:38 +01:00
Daniel Eklöf
f9854d93cf
Merge branch 'master' into releases/1.10 2021-11-22 21:55:06 +01:00
Daniel Eklöf
4a47730f15
Merge branch 'osc8-overwrite-2'
Closes #801
Closes #804
2021-11-22 21:50:30 +01:00
Daniel Eklöf
5b176dd5d6
term: print: reset ‘col’ after padding the right margin 2021-11-21 18:09:40 +01:00
Daniel Eklöf
315769b50b
Revert "term: print: erase URI range when printing right-margin padding"
This reverts commit bb967fd2f927d90e881ed2b05db1fa6946033580.
2021-11-21 18:09:40 +01:00
Daniel Eklöf
65944906bf
term: print: erase URI range when printing right-margin padding 2021-11-21 18:09:40 +01:00
Daniel Eklöf
3c6239c66f
term: print: re-order col/row/cell assigments 2021-11-21 18:09:39 +01:00
Daniel Eklöf
ad8d1bf25c
changelog: osc-8 data not being cleared when cell is overwritten 2021-11-21 18:09:37 +01:00
Daniel Eklöf
f27ccd999e
grid: refactor grid_row_uri_range_erase()
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
2021-11-21 18:09:27 +01:00
Daniel Eklöf
503c2ebd50
grid: row_uri_range_erase(): assume caller has checked row->extra != NULL 2021-11-21 18:09:27 +01:00
Daniel Eklöf
0be55ef74c
term: erase_cell_range(): check if row->extra != NULL 2021-11-21 18:09:27 +01:00
Daniel Eklöf
53fc1a1cb1
term: tail-call optimize calls to grid_row_uri_range_erase() 2021-11-21 18:09:27 +01:00
Daniel Eklöf
09a331857a
term: call grid_row_uri_range_erase() when printing cells 2021-11-21 18:09:26 +01:00
Daniel Eklöf
1a0de0017f
grid: add grid_row_uri_range_erase()
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).
2021-11-21 18:09:26 +01:00
Daniel Eklöf
7522c2d211
changelog: pipe-* key bindings not being parsed correctly 2021-11-21 18:09:10 +01:00
Daniel Eklöf
cdb2d90b89
config: argv_compare(): change parameters to ‘struct argv *’
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.
2021-11-21 18:04:36 +01:00
Daniel Eklöf
9174e6d79a
config: pipe_argv_from_value(): plug memory leak
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.
2021-11-21 17:51:46 +01:00
Daniel Eklöf
106e14391f
Merge branch 'fix-809'
Closes #809
2021-11-21 17:45:17 +01:00
Craig Barnes
c683116f8a Merge branch 'remove-unreachable' 2021-11-21 10:44:24 +00:00
Daniel Eklöf
17c97ed57b
Merge branch 'theme-papercolor' 2021-11-21 11:08:58 +01:00
Daniel Eklöf
9b232e07f9
config: create a copy of the section name
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.
2021-11-21 10:55:57 +01:00
Arnavion
31c1b91a7c Fix parsing key-bindings config to not read past the end of the string.
pipe_argv_from_value itself stripped the cmd-to-exec from ctx->value,
so the callers should not be doing that themselves.

Fixes #809
2021-11-20 20:49:01 -08:00
Soc Virnyl Silab Estela
1634b71e6f
Comment out selection-* for consistency
- Changes in PaperColor Themes
2021-11-21 06:56:30 +08:00
Daniel Eklöf
43798685d8
Merge branch 'cell-color-source' 2021-11-20 18:07:45 +01:00
Daniel Eklöf
d46af6bd7a
term: track cell color source
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...
2021-11-20 16:46:38 +01:00
Craig Barnes
e89e735995 config: use stack allocation for temporary buffer in value_to_enum()
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.
2021-11-20 15:23:24 +00:00
Craig Barnes
0db125a125 config: fix memory leak in value_to_enum()
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.
2021-11-20 15:12:56 +00:00
Xiretza
877c1e6f07 config: Simplify render-timer option handling 2021-11-20 11:58:49 +01:00
Xiretza
02bb2768f1 config: Remove some "UNREACHABLE" UB footguns
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.
2021-11-20 11:58:44 +01:00
Daniel Eklöf
37b82efa77
ci: one more text-shaping -> grapheme-shaping+run-shaping 2021-11-20 11:31:31 +01:00
Daniel Eklöf
154caae35a
ci: fcft: replace text-shaping with grapheme-shaping+run-shaping 2021-11-20 11:24:13 +01:00
Soc Virnyl Silab Estela
6ee0267872
Add PaperColor theme variants
- color palettes taken from https://github.com/NLKNguyen/papercolor-theme
2021-11-18 00:34:55 +08:00
Daniel Eklöf
d70a21355c
Merge branch 'letter-spacing-regression' 2021-11-15 19:28:54 +01:00
Daniel Eklöf
b22322bfd1
config: letter-spacing: add missing ‘return’
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
2021-11-15 19:22:06 +01:00
Daniel Eklöf
c645be7585
Merge branch 'footclient-xdg-desktop' 2021-11-15 12:17:50 +01:00
Daniel Eklöf
843ba49565
footclient.desktop: new XDG desktop file, for footclient 2021-11-15 12:14:51 +01:00
Daniel Eklöf
31966f5494
meson: add -Dthemes=false|true
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.
2021-11-14 23:12:18 +01:00
Daniel Eklöf
48758a101e
changelog: add new ‘unreleased’ section 2021-11-14 18:26:24 +01:00
Daniel Eklöf
dc6c650adb
Merge branch 'releases/1.10' 2021-11-14 18:25:48 +01:00