slave: set TERMINFO instead of TERMINFO_DIRS

This seems to be slightly better supported than TERMINFO_DIRS. It also
simplifies our code, since it’s no longer an issue of whether to
append or not - we just set TERMINFO, and ignore whatever it was set
to before.

Also closes #687
This commit is contained in:
Daniel Eklöf 2021-08-18 20:18:35 +02:00
parent ee68a3fe95
commit 8a7264e905
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 20 additions and 28 deletions

View file

@ -158,14 +158,14 @@ mkdir -p bld/release && cd bld/release
Available compile-time options: Available compile-time options:
| Option | Type | Default | Description | Extra dependencies | | Option | Type | Default | Description | Extra dependencies |
|--------------------------------------|---------|----------------------------|---------------------------------------|--------------------| |--------------------------------------|---------|----------------------------|----------------------------------|--------------------|
| `-Ddocs` | feature | `auto` | Builds and install documentation | scdoc | | `-Ddocs` | feature | `auto` | Builds and install documentation | scdoc |
| `-Dime` | bool | `true` | Enables IME support | None | | `-Dime` | bool | `true` | Enables IME support | None |
| `-Dgrapheme-clustering` | feature | `auto` | Enables grapheme clustering | libutf8proc | | `-Dgrapheme-clustering` | feature | `auto` | Enables grapheme clustering | libutf8proc |
| `-Dterminfo` | feature | `enabled` | Build and install terminfo files | tic (ncurses) | | `-Dterminfo` | feature | `enabled` | Build and install terminfo files | tic (ncurses) |
| `-Ddefault-terminfo` | string | `foot` | Default value of `TERM` | none | | `-Ddefault-terminfo` | string | `foot` | Default value of `TERM` | none |
| `-Dcustom-terminfo-install-location` | string | `${datadir}/foot/terminfo` | Value to append to `TERMINFO_DIRS` | None | | `-Dcustom-terminfo-install-location` | string | `${datadir}/foot/terminfo` | Value to set `TERMINFO` to | None |
Documentation includes the man pages, the example `foot.ini`, readme, Documentation includes the man pages, the example `foot.ini`, readme,
changelog and license files. changelog and license files.
@ -178,24 +178,24 @@ where individual terminfo files cannot easily be installed.
co-exist with ncurses version. The idea is that you install foots co-exist with ncurses version. The idea is that you install foots
terminfo to a non-standard location, for example terminfo to a non-standard location, for example
`/usr/share/foot/terminfo`. Use `-Dcustom-terminfo-install-location` `/usr/share/foot/terminfo`. Use `-Dcustom-terminfo-install-location`
to tell foot where the terminfo is. Foot will append this path to the to tell foot where the terminfo is. Foot will set the environment
`TERMINFO_DIRS` environment variable in the client applications variable `TERMINFO` to this value (with `${prefix}` added). The value
process. The value is **relative to ${prefix}**. is **relative to ${prefix}**.
Conforming applications _should_ look in `TERMINFO_DIRS` first, and Conforming applications _should_ look in `TERMINFO` first, and
fallback to the builtin default (e.g. `/usr/share/terminfo`) if not fallback to the builtin default (e.g. `/usr/share/terminfo`) if not
found. Thus, it will prefer foots version, if it exists (which it found. Thus, it will prefer foots version, if it exists (which it
typically will on localhost), and fallback to ncurses version if not typically will on localhost), and fallback to ncurses version if not
(e.g. on remote systems, where foots terminfo package has not been (e.g. on remote systems, where foots terminfo package has not been
installed). installed).
If set to `no`, foot will **not** set or modify `TERMINFO_DIRS` at If set to `no`, foot will **not** set or modify `TERMINFO` at all. Use
all. Use this if you do not intend to use/support foots terminfo this if you do not intend to use/support foots terminfo definitions
definitions at all. at all.
`-Dterminfo` can be used to disable building the terminfo definitions `-Dterminfo` can be used to disable building the terminfo definitions
in the meson build. It does **not** change the default value of in the meson build. It does **not** change the default value of
`TERM`, and it does **not** disable `TERMINFO_DIRS`. `TERM`, and it does **not** disable `TERMINFO`.
Example: Example:
@ -204,8 +204,8 @@ meson --prefix=/usr -Dcustom-terminfo-install-location=lib/foot/terminfo
``` ```
The above tells foot its terminfo definitions will be installed to The above tells foot its terminfo definitions will be installed to
`/usr/lib/foot/terminfo`. This is the value foot will append to the `/usr/lib/foot/terminfo`. This is the value foot will set the
`TERMINFO_DIRS` environment variable. `TERMINFO` environment variable to.
If `-Dterminfo` is enabled (the default), then the terminfo files will If `-Dterminfo` is enabled (the default), then the terminfo files will
be built as part of the regular build process, and installed to the be built as part of the regular build process, and installed to the

View file

@ -12,4 +12,4 @@ option('default-terminfo', type: 'string', value: 'foot',
description: 'Default value of the "term" option in foot.ini.') description: 'Default value of the "term" option in foot.ini.')
option('custom-terminfo-install-location', type: 'string', option('custom-terminfo-install-location', type: 'string',
description: 'Path to foot\'s terminfo, relative to ${prefix}. If set to anything but “no“, foot will append this value to TERMINFO_DIRS in the client process.') description: 'Path to foot\'s terminfo, relative to ${prefix}. If set to anything but “no“, foot will set TERMINFO to this value in the client process.')

10
slave.c
View file

@ -290,15 +290,7 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
setenv("COLORTERM", "truecolor", 1); setenv("COLORTERM", "truecolor", 1);
#if defined(FOOT_TERMINFO_PATH) #if defined(FOOT_TERMINFO_PATH)
const char *terminfo_dirs = getenv("TERMINFO_DIRS"); setenv("TERMINFO", FOOT_TERMINFO_PATH, 1);
if (terminfo_dirs != NULL) {
char *updated_terminfo_dirs =
xasprintf("%s:%s", terminfo_dirs, FOOT_TERMINFO_PATH);
setenv("TERMINFO_DIRS", updated_terminfo_dirs, 1);
free(updated_terminfo_dirs);
} else
setenv("TERMINFO_DIRS", FOOT_TERMINFO_PATH, 1);
#endif #endif
char **_shell_argv = NULL; char **_shell_argv = NULL;