Commit graph

3703 commits

Author SHA1 Message Date
Daniel Eklöf
0da766e505
selection: don’t strip formatting C0 control characters in bracketed paste mode
It’s ok to let the receiving end handle formatting C0 control
characters in bracketed paste mode.

In fact, we *must* let them through. Otherwise it is impossible to
paste e.g. tabs into editors and similar applications.
2021-02-12 15:59:07 +01:00
Daniel Eklöf
1c8c76708d
Merge branch 'add-missing-short-options-to-usage' 2021-02-12 09:07:13 +01:00
Daniel Eklöf
59b127dc69
main/client: add missing short options to usage (--help output)
Initially, these options *did not* have short options. Then, in
e813883367, the short options were added
to footclient’s getopt_long() call.

This was in a sense incorrect. But instead of reverting it, the short
options were made official in
8eaa195990, by adding the short options
to foot, documenting them in the man pages, and adding them to the
shell completions.

Though the commit message of 8eaa195990
says the options have now been included in usage(), they were in
fact *not* added to usage.

This patch does just that.
2021-02-12 09:02:25 +01:00
Daniel Eklöf
4753d34163
changelog: use standard signals for SIGCHLD 2021-02-11 19:54:55 +01:00
Daniel Eklöf
da7da4cba5
Merge branch 'log-level'
Closes #337
2021-02-11 19:00:09 +01:00
Daniel Eklöf
e5edf7a52b
Merge branch 'fdm-signal-handling' 2021-02-11 18:56:45 +01:00
Daniel Eklöf
23bc3b2179
reaper: monitor SIGCHLD using the FDM instead of via a signalfd
In addition to letting the FDM do the low-level signal watching, this
patch also fixes a bug; multiple SIGCHLDs, be it delivered either through a
signal, or via a signalfd, can be coalesced, like all signals.

This means we need to loop on waitpid() with WNOHANG until there are
no more processes to reap.

This in turn requires a small change to the way reaper callbacks are
implemented.

Previously, the callback was allowed to do the wait(). This was
signalled back to the reaper through the callback’s return value.

Now, since we’ve already wait():ed, the process’ exit status is passed
as an argument to the reaper callback.

The callback for the client application has been updated accordingly;
it sets a flag in the terminal struct, telling term_destroy() that the
process has already been wait():ed on, and also stores the exit
status.
2021-02-11 18:55:30 +01:00
Daniel Eklöf
34699ad3b2
render: block all signals in the rendering threads 2021-02-11 18:55:30 +01:00
Daniel Eklöf
7c3a126b22
main: monitor SIGINT+SIGTERM using the FDM 2021-02-11 18:55:30 +01:00
Daniel Eklöf
863ae1143f
fdm: add support for managing signals
Add fdm_signal_add() and fdm_signal_del(). Signals added to the fdm
will be monitored, and the provided callback called as “soon as
possible” from the main context (i.e not from the signal handler
context).

Monitored signals are *blocked* by default. We use epoll_pwait() to
unblock them while we’re polling. This allows us to do race-free
signal detection.

We use a single handler for all monitored signals; the handler simply
updates the signal’s slot in a global array (sized to fit SIGRTMAX
signals).

When epoll_pwait() returns EINTR, we loop the global array. The
callback associated with each signal that fired is called.
2021-02-11 18:55:21 +01:00
Craig Barnes
5437321f97 main: client: factor out some common code for "--log-level" option 2021-02-11 11:08:18 +00:00
Craig Barnes
1add430b5b Merge branch 'xassert-false' 2021-02-10 21:03:00 +00:00
Craig Barnes
19a5f25b80 Mark slave_exec() as "noreturn" and convert xassert(false) to BUG(...) 2021-02-10 09:18:50 +00:00
Craig Barnes
3c86af52c2 Convert all but 2 remaining uses of xassert(false) to BUG("...") 2021-02-10 09:01:51 +00:00
Daniel Eklöf
c97e5da7c6
Merge branch 'turn-meson-terminfo-option-into-a-feature' 2021-02-09 21:30:12 +01:00
Daniel Eklöf
7698077331
changelog: -d,--log-level 2021-02-09 21:22:16 +01:00
Daniel Eklöf
80cd3df790
completions: fish: -d,--log-level 2021-02-09 21:22:16 +01:00
Daniel Eklöf
2c5beed362
completions: zsh: -d,--log-level 2021-02-09 21:22:16 +01:00
Daniel Eklöf
4ddd2cad91
doc: footclient.1: document -d,--log-level 2021-02-09 21:22:16 +01:00
Daniel Eklöf
50e9cfd2e6
doc: foot.1: document -d,--log-level 2021-02-09 21:22:16 +01:00
Daniel Eklöf
4d42094a64
client: add -d,--log-level 2021-02-09 21:22:16 +01:00
Daniel Eklöf
ca3974cc24
main: add -d,--log-level=[debug,info,warning,error] 2021-02-09 21:22:16 +01:00
Daniel Eklöf
208014d6c9
log: log-level applies to messages logged to stderr too 2021-02-09 20:54:17 +01:00
Daniel Eklöf
fcb524fc72
csi: add 47+1047 (alt screen) to DECRQM 2021-02-09 20:02:29 +01:00
Daniel Eklöf
d16217eca9
Merge remote-tracking branch 'origin/debug-log' 2021-02-09 19:52:53 +01:00
Daniel Eklöf
3d71b74442
install: add -Dterminfo to list of compile-time options 2021-02-09 19:46:06 +01:00
Daniel Eklöf
b65366f00c
changelog: -Dterminfo changed from boolean to feature option 2021-02-09 19:44:57 +01:00
Daniel Eklöf
bdc5810ff4
meson: convert -Dterminfo from a boolean to a feature option
Patch from Jan Beich
2021-02-09 19:42:55 +01:00
Craig Barnes
2f81a1d07c Convert some more uses of xassert(false) to BUG("...") 2021-02-09 15:16:19 +00:00
Craig Barnes
1ec5684438 Convert some uses of xassert(false) to BUG("some error message") 2021-02-09 13:52:33 +00:00
Craig Barnes
7656744877 debug: make use of log_msg() in fatal_error() and bug() functions
Instead of writing directly to stderr and/or syslog(3).
2021-02-09 12:32:33 +00:00
Craig Barnes
e19db15104 render: use portable HAS_INCLUDE() wrapper instead of __has_include() 2021-02-09 03:14:08 +00:00
Daniel Eklöf
79e054faff
Merge branch 'refactor-key-bindings' 2021-02-08 18:57:17 +01:00
Daniel Eklöf
fb5f74062c
Merge branch 'url-parser-recognize-percent'
Closes #338
2021-02-08 18:56:38 +01:00
Daniel Eklöf
1710c1452a
url-mode: ‘%’ is a valid URI character (but don’t allow it at the end)
Closes #338
2021-02-08 16:02:07 +01:00
Daniel Eklöf
5c3d52e4c7
Merge branch 'kitty-theme' 2021-02-08 13:19:23 +01:00
Stefan Tatschner
a3270d226a Add kitty theme 2021-02-08 13:17:16 +01:00
Daniel Eklöf
274e5ce5af
Merge branch 'prefer-tll_remove-over-tll_free' 2021-02-08 12:24:09 +01:00
Daniel Eklöf
4bad85b593
misc: when free:ing tll lists, prefer tll_remove() over tll_free()
In many places we have the following pattern:

  tll_foreach(list, it)
     free(it->item.thing);
  tll_free(list);

Since all tll functions are macros, and thus inlined, and since
tll_free in itself expands to a tll_foreach(), the above pattern
expands to more native code than necessary.

This is somewhat smaller:

  tll_foreach(list, it) {
      free(it->item.thing);
      tll_remove(list, it);
  }
2021-02-08 10:09:59 +01:00
Daniel Eklöf
03bac9dada
key-bindings: refactor: use a single type for all key bindings
Up until now, the various key binding modes (“normal”, “search” and
“url”) have used their own struct definitions for their key bindings.

The only reason for this was to have a properly typed “action” (using
the appropriate “action” enum).

This caused lots of duplicated code. This patch refactors this to use
a single struct definition for the “unparsed” key bindings handled by
the configuration, and another single definition for “parsed” bindings
used while handling input.

This allows us to implement configuration parsing, keymap translation
and so on using one set of functions, regardless of key binding mode.
2021-02-08 10:09:14 +01:00
Daniel Eklöf
63a50afc8e
Merge branch 'url-detection' 2021-02-08 10:06:13 +01:00
Daniel Eklöf
24263412dc
url-mode: urls_render(): early exit when URL list is empty 2021-02-07 16:33:35 +01:00
Daniel Eklöf
9ee392dc8c
url-mode: generate-key-combos: minor efficiency tweaks
* Use a do..while loop; this lets us drop the second half of the loop
  condition.

* Call wcslen(prefix) once, *before* iterating the alphabet
  characters.

* Step through the alphabet characters using a  pointer, as this
  avoids an indexed load (with possibly an imul instruction in
  e.g. -Os builds).
2021-02-07 16:33:35 +01:00
Daniel Eklöf
c84e379767
url-mode: be consistent; use xmalloc() + xrealloc() 2021-02-07 16:33:35 +01:00
Daniel Eklöf
9066ba87df
url-mode: early exit when assigning key combos to empty list 2021-02-07 16:33:35 +01:00
Daniel Eklöf
fec19f1503
changelog: URL mode 2021-02-07 16:33:35 +01:00
Daniel Eklöf
0c847cfe7b
doc: foot.1: document the new URL mode 2021-02-07 16:33:35 +01:00
Daniel Eklöf
4b67394a5f
readme: document the new URL mode 2021-02-07 16:33:35 +01:00
Daniel Eklöf
5af481cd89
render: urls: blank out keys already pressed 2021-02-07 16:33:35 +01:00
Daniel Eklöf
85f7503aec
render: urls: fix string formatter in swprintf() 2021-02-07 16:33:35 +01:00