Commit graph

4946 commits

Author SHA1 Message Date
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
Daniel Eklöf
589404b32e
meson: bump version to 1.10.0 2021-11-14 18:12:30 +01:00
Daniel Eklöf
d00d1b2514
changelog: prepare for 1.10.0 2021-11-14 18:10:43 +01:00
Daniel Eklöf
ef862bd747
Merge branch 'user-notification-cleanup' 2021-11-14 17:56:24 +01:00
Craig Barnes
759bc8007b user-notification: config: various small cleanups
* Rename user_notification_add() to user_notification_add_fmt()
* Add new user_notification_add() helper function
* Use xvasprintf() to replace user_notification_add_va()
* Make better use of helper functions in config.c
2021-11-14 15:16:32 +00:00
Daniel Eklöf
0686f94b18
config: remove options that were deprecated in 1.8.x
* [main].bell
* [main].jump-label-letters
* [main].url-launch
* [main].osc8-underline
2021-11-14 14:21:11 +01:00
Craig Barnes
26515b7ab9 changelog: fix minor grammatical mistake 2021-11-14 11:42:23 +00:00
Daniel Eklöf
9fedb43511
themes: solarized-dark: add commented out selection fg/bg colors 2021-11-13 17:48:04 +01:00
Daniel Eklöf
d8c7536124
themes: add solarized-dark-normal-brights
This is a custom version of solarized-dark, where the bright colors
have been generated by increasing the regular colors’ luminance by
20%.

In other words, this version does *not* have the solarized colors that
normally occupy the bright colors. Thus, if you want the full
solarized experience in e.g. editors, make sure to use editor-specific
24-bit themes.
2021-11-13 17:45:43 +01:00
Daniel Eklöf
d1a76a67c0
Merge branch 'configurable-dim-colors'
Closes #776
2021-11-13 17:40:34 +01:00
Daniel Eklöf
c01904a2c7
config: add [colors].dim0-7
This allows you to configure custom colors to be used when colors are
being dimmed (`\E[2m`).

It is implemented by color matching (just like
bold-text-in-bright=palette-based); the color-to-be-dimmed is matched
against the current color palette.

If it matches one of the regular colors (colors 0-7), the
corresponding “dim” color will be used.

If it matches one of the bright colors (colors 8-15), the
corresponding “regular” color will be used (but *only* if the “dim”
color has been set).

Otherwise, the color is dimmed by reducing its luminance.

The default behavior, i.e. when dim0-7 hasn’t been configured, is to
dim by reducing luminance for *all* colors. I.e. we don’t do any color
matching at all. In particular, this means that dimming a bright color
will *not* result in the corresponding “regular” color.

Closes #776
2021-11-13 17:39:08 +01:00
Daniel Eklöf
0d2a429109
doc: foot.ini: try to clear up the meaning of (AA)RRGGBB 2021-11-13 17:22:07 +01:00
Daniel Eklöf
c0e67e7c2f
config: scrollback.indicator.text: use value_to_wchars() 2021-11-13 12:40:59 +01:00
Daniel Eklöf
ff6b0fe011
Merge branch 'modify-other-keys-mode-2' 2021-11-13 11:38:08 +01:00
Daniel Eklöf
4a74050999
input: add support for modifyOtherKeys=2
Similar to modifyOtherKeys=1 (foot’s default, and only, mode), except
that:

* All modifiers (and not just Ctrl) generate \E[27;m;n~ escapes
* Regular keys (with modifiers) also generate \E[27;m;n~ escapes (for
  example, C-h no longer generates ^H, but \E[27;5;104~)

For our keymap based lookups, this is handled by adding
MOD_MODIFY_OTHER_KEYS_STATE<N> variants.

For “generic” keys, we simply adjust the conditions for when to emit a
\E[27;m;n~ escape - the only requirement is that at least one modifier
is active.
2021-11-13 11:09:07 +01:00
Daniel Eklöf
9412389051
Merge branch 'no-scrollback-multiplier-on-alt-screen'
Closes #787
2021-11-13 11:05:45 +01:00
Daniel Eklöf
ebcf5a4b4f
input: don’t apply [scrollback].multiplier when alt screen is in use
Closes #787
2021-11-13 11:05:36 +01:00
Daniel Eklöf
e026ef22f4
Merge branch 'config-refactor' 2021-11-13 11:04:54 +01:00
Daniel Eklöf
b5f7c414a9
changelog: boolean options 2021-11-13 11:04:30 +01:00