Commit graph

5954 commits

Author SHA1 Message Date
Daniel Eklöf
dc7642f2a5
csi: implement "CSI ? m" 2023-04-26 18:30:09 +02:00
Daniel Eklöf
a2db3cdd5b
render: regression: keep empty bottom scroll margin empty after resize 2023-04-12 18:09:41 +02:00
Daniel Eklöf
e2baa65238
render: ensure scroll region’s endpoint is valid after a window resize
If we had a non-empty bottom scroll region, and the window was resized
to a smaller size, the scroll region was not reset correctly.

This led to a crash when scrolling the screen content.

Fix by making sure the scroll region’s endpoint is within range.
2023-04-12 17:57:53 +02:00
Vivian Szczepanski
98528da5e5
meson: bump tllist dependency version to 1.1.0
The tll_sort() macro was added to tllist in version 1.1.0, and so
building with a previous version causes a linking error.
2023-04-09 09:05:50 +02:00
Daniel Eklöf
479b3c8ee1
*.desktop: add StartupWMClass=foot
At least Gnome needs this in order to link running instances of foot
to their corresponding .desktop file, used e.g. when determining which
icon to display for running applications.

Closes #1317
2023-04-05 14:42:34 +02:00
Daniel Eklöf
a858934c04
changelog: add a new ‘unreleased’ section 2023-04-03 18:57:50 +02:00
Daniel Eklöf
446288d9a1
Merge branch 'releases/1.14' 2023-04-03 18:57:32 +02:00
Daniel Eklöf
ae6bbce6c2
meson: bump version to 1.14.0 2023-04-03 18:52:42 +02:00
Daniel Eklöf
862a003b5b
changelog: prepare for 1.14.0 2023-04-03 18:52:22 +02:00
Daniel Eklöf
ae81f5af4c
terminfo: remove DECRST of DECCOLM+DECSCLM
We’ve never supported neither 132-column mode, nor smooth
scrolling. But we _did_ recognize the escape sequences.

We don’t, anymore. Thus it makes very little sense to include these
escapes in any of our terminfo capabilities. So, remove them.
2023-04-02 18:00:38 +02:00
Daniel Eklöf
f114068a46
csi: DECCOLM+DECSCLM: remove all support
We don’t support neither 132 column mode, nor smooth scrolling. Thus
it makes little sense to recognize these control condes.

Note that while XTerm does support 132 columns, it is disabled by
default. In this mode, XTerm also doesn’t trigger the
side-effects (i.e. clearing the screen).

Closes #1265
2023-03-31 13:16:43 +02:00
Daniel Eklöf
0bc934070c
ci (woodpecker): do a second release build, using clang instead of gcc 2023-03-31 13:16:11 +02:00
Daniel Eklöf
e71e7f5cf6
input: kitty: don’t treat zero-length utf8/utf32 strings as text
This is a regression introduced in 3215d54f31

Symptoms: e.g. arrow keys not working in vim/neovim
2023-03-31 11:34:04 +02:00
Daniel Eklöf
deb43c8dc3
changelog: typo: now -> not 2023-03-31 10:43:39 +02:00
Daniel Eklöf
03b23ed6e5
changeloge: remove bad escape char 2023-03-31 10:42:50 +02:00
Daniel Eklöf
a5dd003627
changelog: remove trailing back-tick 2023-03-31 10:41:17 +02:00
Daniel Eklöf
27c52fb4e3
test: config: call FcIni() + FcFini()
Some of the config options we’re testing result in calls to FontConfig
APIs. Without calling FcIni()+FcFini(), we leak memory:

  Direct leak of 768 byte(s) in 3 object(s) allocated from:
      #0 0x7f7e95cbfa89 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
      #1 0x7f7e95bd1fe5  (/usr/lib/libfontconfig.so.1+0x20fe5)

  Indirect leak of 96 byte(s) in 3 object(s) allocated from:
      #0 0x7f7e95cbf411 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
      #1 0x7f7e95bd63fd  (/usr/lib/libfontconfig.so.1+0x253fd)

  Indirect leak of 19 byte(s) in 2 object(s) allocated from:
      #0 0x7f7e95c72faa in __interceptor_strdup /build/gcc/src/gcc/libsanitizer/asan/asan_interceptors.cpp:439
      #1 0x7f7e95bd1898 in FcValueSave (/usr/lib/libfontconfig.so.1+0x20898)
2023-03-31 10:30:58 +02:00
Daniel Eklöf
981e4b77cb
term: protect against integer overflow when accumulating scroll damage
When accumulating scroll damage, we check if the last scroll damage’s
scrolling region, and type, matches the new/current scroll damage. If
so, the number of lines in the last scroll damage is increased,
instead of adding a new scroll damage instance to the list.

If the scroll damage list isn’t consumed, this build up of scroll
damage would eventually overflow.

And, even if it didn’t overflow, it could become large enough, that
when later used to calculate e.g. the affected surface area, while
rendering a frame, would cause an overflow there instead.

This patch fixes both issues by:

a) do an overflow check before increasing the line count
b) limit the line count to UINT16_MAX
2023-03-30 16:13:19 +02:00
Daniel Eklöf
7bc22862fa
render: protect against integer underflow when calculating scroll area
When applying scroll damage, we calculate the affected region’s
height (in pixels), by subtracting the number of rows to scroll, from
the scrolling region, and finally multiply by the cell height.

If the number of rows to scroll is very large, the subtraction may
underflow, resulting in a very large height value instead of a
negative one.

This caused the check for "scrolling too many lines" to fail. That in
turn resulted in an integer overflow when calculating the source
offset into the rendered surface buffer, which typically triggered a
segfault.

This bug happened when there was continuous output in the terminal
without any new frames being rendered. This caused a buildup of scroll
damage, that triggered the underflow+overflow when we finally did
render a new frame.

For example, a compositor that doesn’t send any frame callbacks (for
example because the terminal window is minimized, or on a different
workspace/tag) would cause this.

Closes #1305
2023-03-30 16:13:18 +02:00
Daniel Eklöf
3215d54f31
input: (kitty kbd): the resulting UTF-8 string may translate to multiple UTF-32 codepoints
When this happened (for example, by specifying a custom compose
sequence), the kitty keyboard protocol didn’t emit any text at all.

This was caused by the utf32 codepoint being -1. This in turned was
caused by us trying to convert the utf8 sequence to a *single* utf32
codepoint.

This patch replaces the use of mbrtoc32() with a call to
ambstoc32(), and the utf32 codepoint with an utf32 string.

The kitty keyboard protocol is updated:

* When determining if we’re dealing with text, check *all* codepoints
  in the utf32 string.

* Add support for multiple codepoints when reporting "associated
  text". The first codepoint is the actual parameter in the emitted
  sequence, and the remaining codepoints are sub-parameters. I.e. the
  codepoints are colon separated.

Closes #1288
2023-03-30 16:12:17 +02:00
Harri Nieminen
ae26915916 fix typos 2023-03-29 00:45:18 +03:00
Daniel Eklöf
296e75f4f5
render: fix glitchy selection while resizing the ‘normal’ screen
The selection coordinates are in absolute row numbers. As such,
selection breaks when interactively resizing the normal grid, since we
then instantiate a temporary grid mapping directly to the current
viewport (for performance reason, to avoid reflowing the entire grid
over and over again).

Fix by stashing the actual selection coordinates, and ajusting the
"active" ones to the temporary grid.
2023-03-27 16:53:41 +02:00
Craig Barnes
5b2f02d826 slave: set $TERM_PROGRAM and $TERM_PROGRAM_VERSION environment variables
These are already being set by iTerm2, WezTerm, tmux and likely some
others. Even though using yet more environment variables seems rather
questionable, if we don't set these we run the risk of inheriting them
from other terminals.

See also:

* 97a6078df8/sources/PTYSession.m (L2568-2570)
* 1d0f68dee9/environ.c (L263-L264)
* https://github.com/search?q=TERM_PROGRAM&type=code
2023-03-20 14:40:36 +00:00
Daniel Eklöf
9f3ce9236f
config: apply fontconfig rules if user didn’t set an explicit font size
If the user didn’t explicitly set the font size (e.g. font=monospace,
instead of font=monospace:size=12), our initial attempt to read the
FC_SIZE and FC_PIXEL_SIZE attributes will fail, and we used to
fallback to setting the size to 8pt.

Change this slightly, so that when we fail to read the FC_*_SIZE
attributes, apply the fontconfig rules, but *without expanding*
them (i.e. without calling FcDefaultSubstitute()).

Then try reading FC_*_SIZE again.

If that too fails, _then_ set size to 8pt. This allows us to pick up
rules that set a default {pixel}size:

    <fontconfig>
      <match>
        <edit name="pixelsize" mode="append"><double>14</double></edit>
    </fontconfig>

Closes #1287
2023-03-06 18:02:10 +01:00
jaroeichler
9da1b1cec3
themes: add Material Amber 2023-03-03 18:31:31 +01:00
Daniel Eklöf
9a5a2d9957
key-binding: sort binding lists
Sort bindings such that bindings with the same symbol are sorted with
the binding having the most modifiers comes first.

This fixes an issue where the “wrong” key binding are triggered when
used with “consumed” modifiers.

For example: if Control+BackSpace is bound before
Control+Shift+BackSpace, then the latter binding is never triggered.

Why? Because Shift is a consumed modifier. This means
Control+BackSpace is “the same” as Control+Shift+BackSpace.

By sorting bindings with more modifiers first, we work around the
problem. But note that it is *just* a workaround, and I’m not
confident there aren’t cases where it doesn’t work.

Closes #1280
2023-03-03 18:29:22 +01:00
Daniel Eklöf
514fcc20a7
render: resize: call xdg_toplevel_set_min_size()
This is a hint to the compositor, not to set a smaller size than this.
2023-03-02 17:22:27 +01:00
Daniel Eklöf
8a849b4b08
render: fix inversed cursor fg color when alpha != 1.0, take #2
No need to check if terminal colors have been reversed - this is done
by the cell rendering logic.

This hopefully fixes all remaining issues with invisible text when
background alpha < 1.0
2023-02-28 17:49:57 +01:00
Daniel Eklöf
7a43737745
render: fix selected cursor cell being ‘invisble’ when background alpha is used
... by taking the cell ‘selected’ state into account when determining
whether to use the default fg or bg as the ‘text’ color.
2023-02-27 17:51:29 +01:00
Daniel Eklöf
7f26914583
wayland: ignore configure events for unmapped surfaces
Closes #1249

Note that it is still unclear whether ack:ing a configure event for an
unmapped surface is a protocol violation, or something that should be
handled by the compositor.

According to
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/108,
Kwin, Mutter and Weston handles it, while wlroots does not.
2023-02-25 09:22:20 +01:00
Craig Barnes
f2356adee3 doc: foot.ini: fix spelling mistake in [bell].urgent description 2023-02-16 09:12:53 +00:00
Craig Barnes
25154a8150 doc: ctlseq: fix capitalization in description of DA3 sequence 2023-02-16 08:50:53 +00:00
Daniel Eklöf
1c16e4a575
Tag a couple variables with UNUSED, to fix warnings with clang-15
Closes #1278
2023-02-12 19:09:48 +01:00
Craig Barnes
1823fa846a completions: bash: simplify awk command used to filter terminfo names 2023-01-27 11:47:12 +00:00
Craig Barnes
b81b98d47c render: fix incorrect indent introduced by previous commit 2023-01-17 23:49:32 +00:00
Daniel Eklöf
a9298959a1
render: fix double-width glyphs glitching when surrounding cells overflow into it
If cells overflowed (for example, by using an italic font that isn’t
truly monospaced) into a double-width glyph (that itself is *not*
overflowing), then the double-width glyph would glitch when being
rendered; typically the second half of it would occasionally
disappear.

This happened because we tried to rasterize the second cell of the
double-width glyph. This cell contains a special “spacer”
value. Rasterizing that typically results the font’s “not available”
glyph.

If _that_ glyph overflows, things broke; we’d later end up forcing a
re-render of it (thus erasing half the double-width glyph). But since
the double-width glyph _itself_ doesn’t overflow, _it_ wouldn’t be
re-rendered, leaving it half erased.

Fix by recognizing spacer cells, and not trying to rasterize them (set
glyph count to 0, and cell count to 1).

Closes #1256
2023-01-17 19:43:47 +01:00
Daniel Eklöf
d1220aebfd
terminfo: sync with ncurses 2023-01-14
* RV/rv: report DA2
* XR/xr: report version (XTVERSION)
* XF: boolean, focus in/out events available
2023-01-15 14:09:08 +01:00
Daniel Eklöf
09f3475ad1
config: don’t double-free key binding auxiliary data
Key bindings with multiple key mappings share auxiliary data (e.g. the
command to execute in pipe-* bindings, or the escape sequence in
text-bindings).

The first one is the designated “master” copy. Only that one should be
freed.

This fixed a double-free on exit, with e.g.

  [text-bindings]
  \x1b\x23=Mod4+space Mod4+equal

Closes #1259
2023-01-15 10:24:01 +01:00
Daniel Eklöf
ffaf08e07c
config: remove unused struct 2023-01-15 10:23:44 +01:00
EuCaue
3f57afbf60
add rose-pine theme 2023-01-13 11:41:05 +01:00
Craig Barnes
becdcd9bb7 completions: bash: complete option arguments for short options 2023-01-10 19:56:12 +00:00
Craig Barnes
8acc10b9d4 completions: bash: use "case" instead of long if/elif/else chain 2023-01-10 19:44:24 +00:00
Craig Barnes
7d28da5006 Use "command -v" instead of "which" in bash completion scripts
The former is a built-in command in bash, whereas the latter is an
external command and isn't always necessarily available.
2023-01-10 18:34:25 +00:00
Grigory Kirillov
a38b8d0222 doc: fix a typo 2023-01-08 00:55:01 +03:00
Craig Barnes
f19768e304 wayland: avoid passing NULL to log_msg() in wayl_reload_xcursor_theme()
This pointer ends up being passed to various printf-family functions,
where passing a NULL pointer for an "%s" format specifier invokes
undefined behaviour.
2023-01-06 23:43:51 +00:00
woojiq
c9465e4c5c
themes: add Onedark 2023-01-06 10:49:45 +01:00
Daniel Eklöf
63bef0dc8c
ci: drop gitlab CI
We’re no longer mirroring to gitlab.
2023-01-02 13:52:56 +01:00
Craig Barnes
1d3023ec5e changelog: amend terminfo names, in accordance with previous commit 2023-01-01 15:21:17 +00:00
Daniel Eklöf
88641005fe
terminfo: PD/PE -> PE/PS
Ncurses 2022-12-24 had the names wrong. It was corrected on
2022-12-29.
2023-01-01 15:21:05 +01:00
Daniel Eklöf
e7c1a93d29
terminfo: add entries for bracketed paste
Ncurses added these in 2022-12-24, but they have been used/supported
by vim since 2017.

* BE - Bracketed paste Enable
* BD - Bracketed paste Disable
* PE - Paste Enable (i.e. "begin")
* PD - Paste Disable (i.e. "end")
2023-01-01 15:07:02 +01:00