Commit graph

1256 commits

Author SHA1 Message Date
Sam McCall
663c9082db
render: dim and brighten using linear rgb interpolation
Adds setting tweak.dim-amount, similar to bold-text-in-bright-amount.

Closes #2006
2025-03-23 15:24:23 +01:00
Daniel Eklöf
5f72f51ae8
changelog: url-mode: show-urls-persistent regression fix 2025-03-20 08:52:19 +01:00
Daniel Eklöf
878e07da59
vt: utf8: don't discard current byte when an invalid UTF-8 sequence is detected
Example:

  printf "pok\xe9mon\n"

would result in 'pokon' - the 'm' has been discarded along with E9.

While correct, in some sense, it's perhaps not intuitive.

This patch changes the VT parser to instead discard everything up to
the invalid byte, but then try the invalid byte from the ground
state. This way, invalid UTF-8 sequences followed by both plain ASCII,
or longer (and valid) UTF-8 sequences are printed as expected instead
of being discarded.
2025-03-18 14:37:28 +01:00
Daniel Eklöf
6813b321f5
changelog: add new 'unreleased' section 2025-03-17 12:15:36 +01:00
Daniel Eklöf
3eef3ec877
changelog: prepare for 1.21.0 2025-03-17 12:04:46 +01:00
Daniel Eklöf
d2ede697f9
config: remove deprecated options 'notify' and 'notify-focus-inhibit'
They've been deprecated since 1.18.0
2025-03-17 12:02:57 +01:00
Daniel Eklöf
cd4ee8ae49
ime: fix initial cursor rectangle being reported as 0,0,0,0
Closes #1994
2025-03-17 08:43:12 +01:00
Daniel Eklöf
d48a1c53f5
meson: require wayland-protocols >= 1.41 2025-03-13 13:28:34 +01:00
Daniel Eklöf
a79fd6a7cf
meson: require fcft-3.3.1
fcft-3.3.0 is not binary compatible with 3.2.x, and earlier.
2025-03-13 13:23:25 +01:00
Daniel Eklöf
16c384b707
changelog: mention some of the side-effects the new fcft requirement brings 2025-03-12 10:06:13 +01:00
Daniel Eklöf
7f11ba59ef
fcft: require fcft >= 3.3.0, add support for new scaling-filters
Update tweak.scaling-filter to recognize the new scaling filters added
in fcft-3.3.0.

Since fcft_set_scaling_filter() is deprecated in 3.3.0, don't use it
anymore, and set the scaling filter via fcft_font_options instead.
2025-03-12 10:03:06 +01:00
Daniel Eklöf
edbfdd5150
changelog: kitty: release events for composed keys 2025-03-11 08:37:42 +01:00
Daniel Eklöf
a80b32d006
term: tweak linebreaking
Don't set linebreak on linefeed. Instead, rely on the default value of
true, and that it is only cleared when a character is printed while
LCF=1.

Note that printing to a row that has linebreak cleared, will set the
linebreak flag again.
2025-03-05 18:55:00 +01:00
Daniel Eklöf
ccf625b991
render: gamma-correct blending
This implements gamma-correct blending, which mainly affects font
rendering.

The implementation requires compile-time availability of the new
color-management protocol (available in wayland-protocols >= 1.41),
and run-time support for the same in the compositor (specifically, the
EXT_LINEAR TF function and sRGB primaries).

How it works: all colors are decoded from sRGB to linear (using a
lookup table, generated in the exact same way pixman generates it's
internal conversion tables) before being used by pixman. The resulting
image buffer is thus in decoded/linear format. We use the
color-management protocol to inform the compositor of this, by tagging
the wayland surfaces with the 'ext_linear' image attribute.

Sixes: all colors are sRGB internally, and decoded to linear before
being used in any sixels. Thus, the image buffers will contain linear
colors. This is important, since otherwise there would be a
decode/encode penalty every time a sixel is blended to the grid.

Emojis: we require fcft >= 3.2, which adds support for sRGB decoding
color glyphs. Meaning, the emoji pixman surfaces can be blended
directly to the grid, just like sixels.

Gamma-correct blending is enabled by default *when the compositor
supports it*. There's a new option to explicitly enable/disable it:
gamma-correct-blending=no|yes. If set to 'yes', and the compositor
does not implement the required color-management features, warning
logs are emitted.

There's a loss of precision when storing linear pixels in 8-bit
channels. For this reason, this patch also adds supports for 10-bit
surfaces. For now, this is disabled by default since such surfaces
only have 2 bits for alpha. It can be enabled with
tweak.surface-bit-depth=10-bit.

Perhaps, in the future, we can enable it by default if:

* gamma-correct blending is enabled
* the user has not enabled a transparent background
2025-03-05 18:45:01 +01:00
Adrian fxj9a
6d39f66eb7
config: add search-bindings.delete-to-{start,end} key bindings
Defaults to ctrl+u and ctrl+k respectively.

Closes #1972
2025-03-05 08:48:23 +01:00
Daniel Eklöf
9e6d334bd8
term: reset the grapheme clustering state on cursor movements 2025-03-04 07:50:03 +01:00
Daniel Eklöf
c41008da31
config+render: allow cursor.style=hollow
Closes #1965
2025-02-19 11:50:25 +01:00
Daniel Eklöf
9f9ffa9434
term: set_app_id(): app_id may be NULL, in which case we can't do strlen()
Closes #1963
2025-02-18 15:09:23 +01:00
Daniel Eklöf
ba5f4abdd4
changelog: --server=FD failing on FreeBSD 2025-02-16 13:56:43 +01:00
Daniel Eklöf
76503fb86a
term: append zero-width grapheme breaking characters to previous cell
When compiled with grapheme clustering support, zero-width characters
that also are grapheme breaks, were ignored (not stored in the
grid).

When utf8proc says the character is a grapheme break, we try to print
the character to the current cell. But this is only done when width >
0. As a result, zero width grapheme breaks were simply discarded.

This only happens when grapheme clustering is enabled; when disabled,
all zero width characters are appended.

Fix this by also requiring the width to be non-zero when if we should
append the character or not.

Closes #1960
2025-02-16 09:13:13 +01:00
Daniel Eklöf
d7a4f9e99e
grid: reflow: fix cursor reflow when LCF is set
When the cursor is at the end of the line, with a pending wrap (LCF
set), the lcf flag should be cleared *and* the cursor moved one cell
to the right.

Before this patch, we cleared LCF, but didn't move the cursor.

Closes #1954
2025-02-13 08:06:21 +01:00
Ludovico Gerardi
888a6770da
themes: update Tokyo Night Light 2025-02-13 08:05:07 +01:00
Daniel Eklöf
8d20b82721
changelog: text-sizing protocol 2025-02-06 14:02:38 +01:00
Daniel Eklöf
88dcde3ed8
term: insert-mode: handle combining characters correctly
When the client application emits combining characters, for example
multi-codepoint emojis, in insert-mode, we ended up pushing partial
graphemes to the right, for each codepoint, resulting in too many
cells (and with the wrong content) being inserted.

The fix is fairly simple; don't "insert" when appending characters to
an existing grapheme cluster.

This isn't something we can detect easily in print_insert() (it would
require us to do grapheme clustering again). Fortunately, we do have
the required information in action_utf8_print(). So, pass this
information as a boolean to term_print().

Closes #1947
2025-02-06 07:37:55 +01:00
Daniel Eklöf
9d8021de47
changelog: custom regex's 2025-02-05 13:46:00 +01:00
Daniel Eklöf
e76d8dd7af
config: remove url.{uri-characters,protocols} 2025-02-05 13:35:17 +01:00
Attila Fidan
5286808b6c
input: close fd on no/unrecognized keymap format 2025-01-30 10:58:19 +00:00
Daniel Eklöf
8d6f0d0583
key-bindings: try all bindings in translated mode before matching untranslated, and then finally raw
When trying to match key bindings, we do three types of matching:

* Match the _translated_ symbol (e.g. Control+C)
* Match the _untranslated_ symbol (e.g. Control+Shift+c)
* Match raw keyboard codes

This was done for *each* key binding. This meant we sometimes matched
a keybinding in raw mode, even though there was a
translated/untranslated binding that would match it too. All depending
on the internal order of the key binding list.

This patch changes it, so that we first try all bindings in translated
mode, then all bindings in untranslated mode, and finally all bindings
in raw mode.

Closes #1929
2025-01-27 12:31:40 +01:00
Daniel Eklöf
846271e8d3
render: resize: configure with only one dimension being zero
The protocol states:

    If the width or height arguments are zero, it means the client
    should decide its own window dimension. This may happen when the
    compositor needs to configure the state of the surface but doesn't
    have any information about any previous or expected dimension.

The wording is a bit ambiguous; does it mean we should set *both*
width and height to values we choose, even if only one dimension is
zero in the configure event? Or does it mean that we should choose the
value for the dimension that is zero in the configure event?

Regardless, it's pretty clear that it does *not* mean we should *only*
choose width and height if *both* dimensions are zero in the configure
event. This is foot's behavior before this patch, meaning if only one
of them is zero, foot assumed the compositor wanted us to set the
width (or height) to zero...

Change this, so that we now choose value for the "missing" dimension,
but do use the compositor provided value for the other dimension.

Closes #1925

Relevant issues:

* https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/155
* https://github.com/YaLTeR/niri/issues/1050
2025-01-26 09:28:54 +01:00
Daniel Eklöf
97385b007f
grid: reflow: regression: remove (truncate) SPACER cells at the end of line
When printing a double-width glyph at the end of the line, it will get
pushed to the next line if there's only one cell left on the current
line.

That last cell on the current line is filled with a SPACER value.

When reflowing the text, the SPACER cell should be "removed", so that
the double-width glyph continues directly after the text on the
previous line.

9567694bab fixed an issue where
reflowing e.g. neofetch output incorrectly removed spaces between the
logo, and the system info. But also introduced a regression where
SPACER values no longer are removed.

This patch tries to fix it, by adding back empty cells, but NOT SPACER
cells.
2025-01-25 08:46:21 +01:00
Daniel Eklöf
f39b75f296
changelog: cwd > 1024 chars 2025-01-24 06:52:52 +01:00
Daniel Eklöf
2ff38e86a7
input: kitty: fix alternate codepoint sometimes not being reported
When alternate key reporting is enabled (i.e. when we're supposed to
report the shifted key along with the unshifted key), we try to figure
out whether the key really is shifted or not (and thus which xkb
keysym to use for the unshifted and shifted keys in the escape).

This was done by getting the layout's *all* modifier combinations that
produce the shifted keysym, and if any of of them contained a modifier
that isn't supported by the kitty protocol, the shifted and unshifted
keys are derived from the same keysym. This is to ensure we handle
things like AltGr-combos correctly.

The issue is, since there may be more than one modifier combination
generating the shifted keysym, we may end up using the wrong keysym
just because _another_ combination set contains modifiers not
supported by the kitty protocol. What we're interrested in is whether
the *pressed* set of modifiers contains such modifiers.

Closes #1918
2025-01-20 09:08:47 +01:00
Daniel Eklöf
10c4e94e1b
Merge branch 'releases/1.20' 2025-01-18 09:43:57 +01:00
Daniel Eklöf
bb60618941
changelog: move utf8proc entry to correct release 2025-01-18 09:31:05 +01:00
Daniel Eklöf
e1d9b57f83
changelog: add back entry to 1.20.1, removed in de3becef96 2025-01-18 09:31:05 +01:00
Daniel Eklöf
15d9b08307
changelog: prepare for 1.20.2 2025-01-18 09:25:19 +01:00
Daniel Eklöf
c5529808c4
term: cursor_refresh(): don't try to dirty the grid if we don't have one
If the compositor sends a keyboard enter event before our window has
been mapped, foot crashes; the enter event triggers a cursor
refresh (hollow -> non-hollow block cursor), which crashes since we
haven't yet allocated a grid.

Fix by no-op:ing the refresh if the window hasn't been configured yet.

Closes #1910
2025-01-18 09:24:00 +01:00
Daniel Eklöf
39061e0422
changelog: colors.flash-alpha=1.0 2025-01-18 09:23:46 +01:00
Alexander Orzechowski
de3becef96
Revert "config: don't allow colors.flash-alpha to be 1.0"
This reverts commit 56d2c3e990.
2025-01-18 09:23:41 +01:00
Daniel Eklöf
ad1e2d7d05
changelog: 'CSI 21 t' and 'OSC 176 ?' disabled 2025-01-18 09:23:35 +01:00
Daniel Eklöf
80ef366bde
changelog: utf8proc.h not found 2025-01-18 09:23:31 +01:00
Daniel Eklöf
c854f35579
changelog: add missing issue ref 2025-01-18 09:23:27 +01:00
Daniel Eklöf
45e5a4b024
changelog: add new 'unreleased' section 2025-01-18 09:23:26 +01:00
Daniel Eklöf
2a07a2e6b9
Add support for the new Wayland protocol xdg-system-bell
From the release notes:

    system bell - allowing e.g. terminal emulators to hand off system
    bell alerts to the compositor for among other things accessibility
    purposes

The new protocol is used when the new config option
bell.system=yes (and the compositor implements the protocol,
obviously).

The system bell is rung independent of whether the foot window has
keyboard focus or not (thus relying on compositor configuration to
determine whether anything should be done or not in response to the
bell).

The new option is enabled by default.
2025-01-17 10:21:50 +01:00
Daniel Eklöf
2c309227f1
term: cursor_refresh(): don't try to dirty the grid if we don't have one
If the compositor sends a keyboard enter event before our window has
been mapped, foot crashes; the enter event triggers a cursor
refresh (hollow -> non-hollow block cursor), which crashes since we
haven't yet allocated a grid.

Fix by no-op:ing the refresh if the window hasn't been configured yet.

Closes #1910
2025-01-09 07:56:57 +01:00
Daniel Eklöf
e136abf1ef
changelog: colors.flash-alpha=1.0 2025-01-09 07:56:10 +01:00
Alexander Orzechowski
301101e7d9
Revert "config: don't allow colors.flash-alpha to be 1.0"
This reverts commit 56d2c3e990.
2025-01-09 07:53:50 +01:00
Daniel Eklöf
bcc176cdf1
changelog: 'CSI 21 t' and 'OSC 176 ?' disabled 2025-01-07 13:01:25 +01:00
Daniel Eklöf
6999968ee5
changelog: utf8proc.h not found 2025-01-04 10:33:23 +01:00
Daniel Eklöf
9667fe2b26
changelog: add missing issue ref 2025-01-03 08:08:52 +01:00