Commit graph

4536 commits

Author SHA1 Message Date
Daniel Eklöf
9b4796e996
render: don’t assume PIXMAN_a8r8g8b8 for color glyphs
We may want to use PIXMAN_b8g8r8a8 on big-endian in the future.
2021-07-14 19:46:18 +02:00
Daniel Eklöf
7afc4c8037
Merge branch 'crash-on-runaway-url' 2021-07-11 13:19:40 +02:00
Daniel Eklöf
8290cebc09
server: the terminal now purges SHM pixmaps on its own 2021-07-11 11:54:08 +02:00
Daniel Eklöf
f030c87ee6
url-mode: abort when running into un-allocated scrollback memory
When tagging URL cells (in preparation for rendering URL mode), we
loop the URL’s entire range, setting the `url` attribute of all cells,
and dirtying the rows.

It is possible to create URLs that are invalid, and wrap around the
scrollback, even though the scrollback hasn’t yet been filled. For
example, by starting an OSC-8 URL, moving the cursor, and then closing
the OSC-8 URL.

These URLs are invalid, but are still rendered just fine. “Fine” being
relative - they will typically fill the entire screen. But at least
that’s a very clear indication for the user that’s something is wrong.

The problem is when we hit un-allocated scrollback rows. We didn’t
check for NULL rows, and crashed.

This has now been fixed.
2021-07-11 11:31:11 +02:00
Daniel Eklöf
d22ba73c41
Merge branch 'crash-in-url-mode-remove-duplicates'
Closes #627
2021-07-11 11:30:31 +02:00
Daniel Eklöf
107cbb1015
shm: close pool FD if buffer doesn’t support SHM scrolling
The only reason to keep the pool FD open is if we’re going to SHM
scroll the buffer; we need the FD for fallocate(FALLOC_FL_PUNCH_HOLE).

In all other cases, there’s absolutely no need to keep the FD
open. Thus, close it as soon as we’ve instantiated the buffer. This
frees up FDs, and help keep foot from FD ulimit.
2021-07-11 10:22:47 +02:00
Daniel Eklöf
cf6d04f9f2
url-mode: fix crash when removing duplicate and/or overlapping URLs
Removing overlaping and duplicated URLs is done by running two nested
loops, that both iterate the same URL list.

When a duplicate is found, one of the URLs is destroyed and removed
from the list.

Deleting and removing an item *is* safe, but only as long as _no
other_ iterator has references to it.

In this case, if we remove an item from e.g. the inner iterator, we’ll
crash if the outer iterator’s *next* item is the item being removed.

Closes #627
2021-07-11 10:06:12 +02:00
Daniel Eklöf
a9872aac5a
wayland: explicitly purge all SHM pixmaps when destroying window
All SHM pixmap cookies depend on the terminal instance’s memory
address. Thus, after a terminal instance has been destroyed, shm
pixmaps that belonged to it will never be purged automatically.
2021-07-11 10:01:22 +02:00
Daniel Eklöf
b5950d9b27
wayland: purge CSD pixmaps when destroying the CSDs
CSDs aren’t typically toggled on and off. Thus, when disabled,
immediately purge their corresponding pixmap buffers, to free up some
memory, and release file descriptors.
2021-07-11 09:59:25 +02:00
Daniel Eklöf
0a6e7e6167
url-mode: purge SHM pixmaps when destroying URLs
Unlike other surface types, the SHM cookie depends on the address of
each URL instance. This means if we enable, disable, and then enable
URL mode again (thus showing exactly the same URLs as the first time),
the URLs will have new addresses, and thus the old SHM pixmaps will
not get purged automatically.

So, manually purge them when destroying the URLs.
2021-07-11 09:59:17 +02:00
Daniel Eklöf
24dd44634a
Merge branch 'man-page-typo' 2021-07-08 20:04:56 +02:00
Ben Brown
9a14e5d818 doc: fix typo in foot man page 2021-07-08 10:43:51 +01:00
Daniel Eklöf
6f1f1f5614
Merge branch 'locked-title' 2021-07-07 19:51:40 +02:00
Daniel Eklöf
fcb60abc13
config: add locked-title=no|yes
Closes #386
2021-07-04 17:59:40 +02:00
Daniel Eklöf
07652d3b9e
term: rows printed to now defaults to having a hard linebreak
That is, instead of requiring a ‘\n’ to be printed, non-empty lines
are now treated as having a hard linebreak by default.

The linebreak is cleared on an explicit wrap.
2021-07-03 18:05:45 +02:00
Daniel Eklöf
d101325885
doc: foot.ini.5: typo: relay-size-ms -> resize-delay-ms 2021-07-02 16:53:49 +02:00
Daniel Eklöf
85b63b5e4a
render: require glyph count > 0 and cell-cols also for forced double-width PUAs 2021-07-02 16:48:46 +02:00
Daniel Eklöf
396a5ff79b
allow-overflowing-double-width-glyphs: take glyph offset into account
A narrow, but offset:ed glyph should still be considered double
width.

This patch also fixes a crash, when the maybe-double width glyph is in
the last column. This is a regression.
2021-07-02 16:31:14 +02:00
Craig Barnes
562096a21a foot.ini: mention Control+c in default "cancel" key bindings
This should have been done as part of commit
6eb6668c3c.
2021-07-02 09:12:57 +01:00
Craig Barnes
b18d3aef17 vt: add some unit tests for action_collect() 2021-07-02 08:46:28 +01:00
Daniel Eklöf
4e8db9d8b6
changelog: s/from/in 2021-07-01 20:44:53 +02:00
Daniel Eklöf
ea39496f30
changelog: add new ‘unreleased’ section 2021-07-01 20:19:28 +02:00
Daniel Eklöf
a99542aad6
Merge branch 'releases/1.8' 2021-07-01 20:19:05 +02:00
Daniel Eklöf
1d488bb6a7
meson/pkgbuild: bump version to 1.8.1 2021-07-01 20:14:35 +02:00
Daniel Eklöf
7112f24671
changelog: prepare for 1.8.1 2021-07-01 20:14:20 +02:00
Daniel Eklöf
fd974e139e
Merge branch 'master' into releases/1.8 2021-07-01 20:13:49 +02:00
Daniel Eklöf
ab8f9afa90
changelog: move grapheme cluster width entry to ‘changed’, and rewrite it 2021-07-01 20:13:03 +02:00
Daniel Eklöf
d9fc1e0d8a
Merge branch 'max-grapheme-width-is-2' 2021-07-01 19:55:50 +02:00
Daniel Eklöf
5138f02214
config: rename at-most-2 (value for grapheme-width-method) to double-width 2021-07-01 08:00:23 +02:00
Daniel Eklöf
9817e44c32
config: add tweak.grapheme-width-method=wcswidth|at-most-2 2021-07-01 07:58:06 +02:00
Daniel Eklöf
031e8f5987
vt: limit grapheme width to 2 cells
All emoji graphemes are double-width. Foot doesn’t support non-latin
scripts. Ergo, this should result in the Right Thing, even though
we’re not doing it the Right Way.

Note that we’re now breaking cursor synchronization with nearly all
applications.

But the way I see it, the applications need to be
updated.
2021-07-01 07:57:56 +02:00
Daniel Eklöf
55bd3cfd62
config: add unit test for config_clone()
We’re mainly interested in seeing that we don’t leak memory, or double
free heap allocated data.

Valgrind and/or gcc/clang sanitizers are best at this, hence the very
few asserts in the test itself.
2021-06-30 21:06:21 +02:00
Daniel Eklöf
88fb8429b0
config: NOINLINE a couple of functions doing tll operations 2021-06-30 19:10:37 +02:00
Daniel Eklöf
56f592e308
Merge branch 'remove-unused-key-bindings'
Closes #614
2021-06-30 18:05:14 +02:00
Daniel Eklöf
149c52bd44
config: remove replaced/removed key bindings, instead of marking as ‘unused’
Instead of keeping removed/replaced key bindings in the key binding
array (marked as ‘unused’), remove them, by compacting the array.

The invariant is thus that there should be *no* entries in the key
binding list with the `BIND_ACTION_NONE` for action.

Add code to debug builds that verifies this, plus a unit test.

Closes #614
2021-06-30 18:05:07 +02:00
Daniel Eklöf
cf46acc68f
render: don’t look at glyphs[0]->cols when determining if overflow should be allowed
Use ‘cell_cols’ instead, which is the number of cells we’ll actually
be using.
2021-06-30 18:01:03 +02:00
Craig Barnes
3e74482d6c terminfo: add Tc, setrgbf and setrgbb capabilities
These extensions are used by tmux and neovim, in order to make use
of 24-bit colors without facing the problems that plague the `RGB`
capability.

This should allow 24-bit colors to work "out of the box" in tmux,
without the usual workaround of adding:

    set-option -ga terminal-overrides ",foot*:Tc"

...to ~/.tmux.conf.

See also:

* 18fe2e8dfa (commitcomment-31373962)
* f83c25942d/runtime/doc/term.txt (L123-L139)
* b1a8c0fe02/CHANGES (L988-L989)

Closes #615
2021-06-29 08:55:53 +01:00
Daniel Eklöf
a09f928175
input: ignore ‘unused’ URL key bindings when mapping bindings to current keymap
This is a temporary fix for #614. Long term fix is to remove the
‘replaced’ bindings from the array at config time.
2021-06-28 22:34:52 +02:00
Daniel Eklöf
117e24dbf4
term: destroy: free URLs before free:ing the grids
Fixes use-after-free when destroying a terminal with “live”
URLs (i.e. when URL mode is active).
2021-06-28 22:33:57 +02:00
Craig Barnes
5dca0458a0 log: add LOG_CLASS_NONE and use as initializer for log_level
This means that logging will be completely disabled until log_init()
has been called, which is useful to prevent log spam when running
UNITTEST{} blocks in debug builds.

Note that this doesn't change the default log level at runtime, which
was already being set to LOG_CLASS_INFO in main.c and client.c.

The new log level is also exposed to the command-line interface as
`--log-level=none`, which allows disabling logging entirely.
2021-06-26 22:15:09 +01:00
Daniel Eklöf
0ff8f72a9d
vt: don’t reset utf8proc grapheme state when we’re not at a grapheme break 2021-06-25 20:42:23 +02:00
Daniel Eklöf
d206697001
doc: benchark: laptop results for 1.8.0 2021-06-25 10:56:40 +02:00
Daniel Eklöf
e365ac0b10
doc: benchmark: add --dat to vtebench command line 2021-06-25 10:24:55 +02:00
Daniel Eklöf
2873043865
doc: benchmarks: update desktop results with 1.8.0 2021-06-25 10:23:43 +02:00
Daniel Eklöf
2535cf51db
changelog: add new ‘unreleased’ section 2021-06-25 08:44:41 +02:00
Daniel Eklöf
3d524746cd
Merge branch 'releases/1.8' 2021-06-25 08:44:11 +02:00
Daniel Eklöf
bc6b4d7b8a
generate-version: fix regression where a tagged version was parsed wrong
The regexps didn’t work when the “extra” portion of “git describe” was
missing.
2021-06-25 08:35:41 +02:00
Daniel Eklöf
0a455174f4
meson/pkgbuild: bump version to 1.8.0 2021-06-25 08:24:42 +02:00
Daniel Eklöf
8df5f90474
changelog: prepare for 1.8.0 2021-06-25 08:23:36 +02:00
Daniel Eklöf
20c0650dfd
wayland: regression: properly instantiate CSDs when there’s no decoration manager
* Set win->configure.csd_mode, not win->csd_mode. Otherwise our
  ‘configure’ handler will swap out the CSD_YES we set, for
  CSD_UNKNOWN(?), resulting in no CSDs at all.

* Don’t instantiate the CSDs in wayl_win_init(), let the ‘configure’
  event handler do that. Just like it does when we have a decoration
  manager emitting decoration configure events.
2021-06-24 23:02:40 +02:00