Commit graph

5396 commits

Author SHA1 Message Date
Daniel Eklöf
d02124902b
client: add -E,--client-environment
When this option is used, the child process in the new terminal
instance will inherit its environment from the footclient process,
instead of the foot server’s.

Implemented by sending (yet another) dynamic string list as part of
the client -> server setup packet. When the new option is *not* used,
the setup packet is now 2 bytes larger than before.

On the server side, the slave process now uses execvpe() instead of
execvp(). There’s plumbing to propagate a new ‘envp’ argument from
term_init() all the way down to slave_exec(). If ‘envp’ is NULL, we
use ‘environ’ instead (thus matching the old behavior of execvp()).

Closes #1004
2022-04-12 15:07:40 +02:00
Craig Barnes
856086bbbe
csi: reduce duplication in code handling SGR 38 and 48 sequences 2022-04-11 14:20:11 +02:00
Daniel Eklöf
6792f5fce0
doc: ctlseq: document XTMODKEYS 2022-04-10 18:36:04 +02:00
Daniel Eklöf
0d42e039bb
changelog: improved compatibility with XTerm when modifyOtherKeys=2 2022-04-10 18:36:04 +02:00
Daniel Eklöf
5d6eaf606b
input: improve XTerm compatibility when modifyOtherKeys=2
Before this, foot always emitted a CSI if _any_ modifier was
active. XTerm doesn’t behave quite like this. Instead, it appears to
special-case shift somewhat:

If the generated symbol (e.g ‘A’) is the upper case version of the
pressed key’s base symbol (‘a’), and is in the range a-z, emit a CSI.

If not emit a plain symbol:

Examples (Swedish layout):

* shift-a (generated symbol is ‘A’) emits a CSI
* shift-, (generated symbol is ‘;’) emits ‘;’
* shift-alt-, (generated symbol is ‘;’) emits a CSI

Closes #1009
2022-04-10 18:34:51 +02:00
Daniel Eklöf
d1a072d67d
pgo: fix selection.{start,end} initializers
This fixes a regression introduced in
5b1f1602bc
2022-04-10 18:31:13 +02:00
Daniel Eklöf
07253c29d1
search: use a local ‘grid’ variable to hold term->grid 2022-04-09 17:28:16 +02:00
Daniel Eklöf
5b1f1602bc
refactor: add a ‘range’ struct, grouping a start and end coord together 2022-04-09 15:09:02 +02:00
Daniel Eklöf
c7dd30742a
config: use fallback when XDG_CONFIG_{HOME,DIRS} is set, but empty 2022-04-07 13:06:01 +02:00
Daniel Eklöf
20608c987b
config: fallback to /etc/xdg if XDG_CONFIG_DIRS is unset
Closes #1008
2022-04-07 13:06:01 +02:00
jvoisin
58a1ffe724
config: add tweak option to allow disabling sixels
Closes #950
2022-04-06 19:25:43 +02:00
Craig Barnes
0d1e6960af
osc: avoid unnecessary calls to strlen(3)
Checking for specific strings of length 0 or 1 can be done with e.g.:

    if (str[0] == '\0') {...}
    if (str[0] == '?' && str[1] == '\0') {...}

Doing it this way instead of using strlen(3) means we avoid the
function call overhead and also avoid scanning through more of the
string than is neceessary.

A compiler could perhaps optimize away calls to strlen(3) when the
result is compared to a small constant, but GCC 11.2 only seems to
actually do this[1] for lengths of 0.

[1]: https://godbolt.org/z/qxoW8qqW6
2022-04-06 18:19:47 +02:00
Daniel Eklöf
5ce1589c60
render: ensure an underline cursor is not positioned too low
The underline cursor is positioned just below regular underlines. A
bug in the positioning logic related to this, sometimes resulted in
the cursor being thinner than what it should be, or even invisible.

Fixes #1005
2022-04-06 18:17:59 +02:00
Merlin Büge
49ba16da25
Small clarification/rewording of default color values
This makes the example config `foot.ini` and its man page slightly more
coherent regarding the specification of default values.

Note that the cursor color is not hardcoded like e.g. foreground or
background, thus in the example config, `<inverse foreground/background>`
makes more sense.
2022-04-06 18:16:40 +02:00
Merlin Büge
ee6007aa07 doc: fix some small typos 2022-04-06 15:46:59 +02:00
Daniel Eklöf
f2870bf56c
doc: foot.ini: escape ‘-’ and ‘*’ 2022-04-05 20:20:55 +02:00
Daniel Eklöf
ca1e4e85d3
foot.ini: fix default value of dpi-aware (it’s ‘auto’) 2022-04-05 19:46:49 +02:00
Daniel Eklöf
ea9d38a6ac
doc: foot.ini: align documented default value of uri-characters with reality
Fixes #1000
2022-04-05 19:42:42 +02:00
L3MON4D3
d6dab2f2ba
Use circles for rendering light arc box-drawing characters.
Ellipses can look weird when the font is narrow.

Closes #988
2022-04-03 18:49:47 +02:00
Mariusz Bialonczyk
bbf9dcc2a3 themes/material-design: add missing bright colors 2022-03-29 08:44:49 +02:00
Daniel Eklöf
de5226c930
dcs: don’t automatically buffer anything
If a request handler doesn’t define its own put() handler, simply drop
all DCS parameter data. This way, we won’t end up allocating
potentially large buffers for unsupported/unimplemented DCS requests.

Closes #959
2022-03-21 20:40:51 +01:00
Daniel Eklöf
67a228bf4b
dcs: xtgettcap: use custom put() handler
Grow buffer exponentially, since XTGETTCAP requests can,
theoretically, be very large.
2022-03-21 20:40:50 +01:00
Daniel Eklöf
af88c19561
dcs: decrqss: use a custom put() handler
Only buffer up to two bytes, as that’s the largest DECRQSS request we
support.
2022-03-21 20:40:50 +01:00
Daniel Eklöf
8f06436985
dcs: map BSU/ESU unhook handlers directly to term_{enable,disable}_app_sync_upates()
That is, drop the local bsu() and esu() functions.
2022-03-21 20:40:50 +01:00
Daniel Eklöf
0b9b726bdf
vt: free OSC buffer after dispatch, if larger than 4K 2022-03-21 20:40:10 +01:00
Daniel Eklöf
1e63dddb89
input: don’t allow non-significant modifiers when matching untranslated symbols
When matching “untranslated” bindings (by matching the base symbol of
the key, e.g. ctrl+shift+2 in US layout), require that no
non-significant modifiers are active.

This fixes an issue where AltGr was “ignored”, and would cause certain
combinations to match a key binding.

Example: ctrl+altgr+0, on many European layouts matched against the
default ctrl+0 (reset the font size), instead of emitting ^]

To make this work, we now need to filter out “locked”
modifiers (e.g. NumLock and CapsLock). Otherwise having e.g. NumLock
active would prevent *all* untranslated matching to fail.

Closes #983
2022-03-20 13:29:29 +01:00
Daniel Eklöf
dcdbb3613c
char32: only include stdc-predef.h if it is available
Use the (relatively new) macro __has_include() to check if
stdc-predef.h exists, and only include it if it does.

If stdc-predef.h does not exist, or if the compiler does not implement
__has_include(), stdc-predef.h is *not* included.
2022-03-19 19:52:21 +01:00
Leonardo Neumann
c365df495e
char32: add missing header to work with musl 2022-03-19 19:05:34 +01:00
Mariusz Bialonczyk
b661b47ee1
themes: add material-design 2022-03-19 19:03:57 +01:00
Daniel Eklöf
485c473e76
selection: don’t translate \r to \n when pasting
In non-bracketed paste mode, we translate \n to \r, and \r\n to
\r. The latter matches XTerm, urxvt, alacritty and kitty. The former
matches alacritty and kitty (xterm and urxvt just blindly replaces all
\n occurrences with \r, meaning \r\n is translated to \r\r.

For some reason, we then unconditionally translated all \r back to \n,
regardless of whether bracketed paste was enabled or not. Unsure
why/where this comes from, but it doesn't match any of the other
terminal emulators I tested.

One example where this caused issues is in older versions of nano (at
least up to 2.9).

Closes #980
2022-03-19 19:01:25 +01:00
Craig Barnes
8d4d22218e csi: add support for DECNKM private mode
This is equivalent to DECKPAM/DECKPNM when enabled/disabled, but can
also be saved/restored/queried with XTSAVE/XTRESTORE/DECRQM.

See also:

* https://vt100.net/docs/vt510-rm/DECNKM.html
* https://vt100.net/docs/vt510-rm/DECKPAM.html
* https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-PC-Style-Function-Keys
2022-03-19 13:44:14 +00:00
Daniel Eklöf
a1287220ab
Merge branch 'nord-and-rezza-themes' 2022-03-13 19:49:08 +01:00
merkix
7914c56dab
foot.ini: change vim modeline from ‘conf’ to ‘dosini’ 2022-03-13 19:46:31 +01:00
Daniel Eklöf
3cefe78b40
osc: use four digits in OSC-4 and OSC-11 rgb:r/g/b replies
Closes #971
2022-03-13 19:44:32 +01:00
Craig Barnes
2a4e7fde8d Merge branch 'osc-buffer-growth' 2022-03-13 18:22:04 +00:00
Mariusz Bialonczyk
2d1677e125 add rezza theme 2022-03-11 07:34:14 +01:00
Mariusz Bialonczyk
d3bfa95910 add Nord theme 2022-03-11 07:34:00 +01:00
Daniel Eklöf
6e536e7ed8
input: get_current_modifiers(): don’t crash if seat has no keyboard
Closes #963
2022-03-04 17:54:19 +01:00
Craig Barnes
cc8e86fd2d dcs: prevent possibility of out-of-bounds reads in decrqss()
This could be triggered by running, for example:

    printf '\033P$qrxyz\033\\'

...which would cause a memcmp() of 4 bytes on a 2 byte string literal.

Fixes: #960
2022-03-02 19:05:51 +00:00
Craig Barnes
a3c5e8927d osc: grow OSC buffer exponentially instead of by fixed increments of 128
With fixed increments of 128 bytes, an OSC 52 copy operation could end
up doing thousands or tens of thousands of realloc(3) calls just to
copy a few MB.
2022-03-02 01:55:25 +00:00
jvoisin
7d647c08ff Wrap setlocale in asserts since it can fail 2022-02-27 16:33:20 +01:00
Enes Hecan
525a71422d
Add JetBrains Darcula theme 2022-02-27 11:36:01 +01:00
Daniel Eklöf
9b343fd9fb
meson: stop using deprecated functions, require meson >= 0.58
* get_pkgconfig_variable() -> get_variable()
* prog.path() -> prog.full_path()
* meson.build_root() -> meson.global_build_root()
2022-02-27 11:28:11 +01:00
Daniel Eklöf
a65804139d
Merge branch 'socket-activation'
Closes #604
2022-02-27 11:13:30 +01:00
Max Gautier
522f4e522e Install notes regarding systemd unit files 2022-02-26 16:10:12 +01:00
Max Gautier
0b7f06bad4 Socket activation changelog entry 2022-02-26 16:09:52 +01:00
Max Gautier
4ec172a4ad Document socket activation feature
- Particular mention to included systemd user units
2022-02-26 16:09:30 +01:00
Max Gautier
1783f69cbd Adding systemd unit files for socket activation
- Support for multiples concurrent instances, templated on
  WAYLAND_DISPLAY
- Use standard input for the socket file descriptor (inetd style)
- Always use the socket provided by systemd with the systemd user
  service
- wayland-instance@.target is intended to be a special target a bit like
  graphical-session.target.
2022-02-26 16:09:30 +01:00
Max Gautier
88a0f7397c Make foot able to receive a socket from its parent
If the argument to --server is parsed as a number, consider it to be a
file descriptor, and use that as a socket.
This is necessary to be able to use socket activation with the server
mode of foot.
2022-02-26 16:09:30 +01:00
Daniel Eklöf
bd5576825f
Merge branch 'scrollback-home-and-end' 2022-02-24 19:23:07 +01:00