fix doc and style

This commit is contained in:
fatalerrors
2026-06-02 17:24:41 +02:00
parent df4c63657b
commit f0c62a5e7f
2 changed files with 21 additions and 11 deletions

View File

@@ -188,17 +188,24 @@ automatically at startup:
| *(absent or `smart`)* | Auto-detect the best available `terminfo` entry (default) | | *(absent or `smart`)* | Auto-detect the best available `terminfo` entry (default) |
| any other string | Exported as-is — standard Unix behaviour | | any other string | Exported as-is — standard Unix behaviour |
When auto-detection runs, emulator hints are checked in order, and the best When auto-detection runs, `COLORTERM=truecolor|24bit` is first evaluated as a
`terminfo` entry confirmed to exist on the system is selected: global truecolor flag. Each emulator hint is then checked in order; within each
branch a `*-direct` terminfo entry (24-bit colour) is tried before the
`*-256color` fallback. Only entries confirmed to exist via `terminfo` are used.
1. **`$COLORTERM`** — `truecolor` or `24bit` `xterm-direct`, then `xterm-256color` 1. **`$COLORTERM`** — `truecolor` or `24bit` sets the truecolor flag for all subsequent probes
2. **`$TERM_PROGRAM`** — `iTerm.app`, `WezTerm`, `Hyper`, `vscode` → appropriate entry 2. **`$TERM_PROGRAM`** — emulator name hints:
3. **`$VTE_VERSION`** — GNOME Terminal, Tilix, …`vte-256color`, then `xterm-256color` - `iTerm.app``xterm-direct`¹, then `xterm-256color`
4. **`$WT_SESSION`** — Windows Terminal → `xterm-256color` - `WezTerm``xterm-direct`¹, then `wezterm`, then `xterm-256color`
5. **`$TMUX`** — tmux session → `tmux-256color`, then `screen-256color` - `Hyper`, `vscode``xterm-direct`¹, then `xterm-256color`
6. **`$STY`** — GNU screen session → `screen-256color`, then `screen` 3. **`$VTE_VERSION`** — GNOME Terminal, Tilix, … → `vte-direct`¹, then `vte-256color`, then `xterm-256color`
4. **`$WT_SESSION`** — Windows Terminal → `xterm-direct`¹, then `xterm-256color`
5. **`$TMUX`** — tmux session → `tmux-direct`¹ → `screen-direct`¹, then `tmux-256color`, then `screen-256color`
6. **`$STY`** — GNU screen session → `screen-direct`¹, then `screen-256color`, then `screen`
7. **Generic probe**`xterm-256color``xterm-color``xterm``vt100` 7. **Generic probe**`xterm-256color``xterm-color``xterm``vt100`
¹ Only attempted when the truecolor flag is set (`COLORTERM=truecolor` or `24bit`).
### 4.2. Module defaults ### 4.2. Module defaults
Each module exposes its hardcoded defaults as configuration keys. Set a key to Each module exposes its hardcoded defaults as configuration keys. Set a key to

View File

@@ -323,7 +323,10 @@ term_set()
# Return true when terminfo has an entry for the given terminal type. # Return true when terminfo has an entry for the given terminal type.
local _term_has local _term_has
_term_has() { tput -T "$1" longname >/dev/null 2>&1; } _term_has()
{
tput -T "$1" longname >/dev/null 2>&1
}
# True-color hint: COLORTERM=truecolor|24bit is set by the emulator. # True-color hint: COLORTERM=truecolor|24bit is set by the emulator.
local _truecolor=0 local _truecolor=0
@@ -386,7 +389,7 @@ term_set()
# 5. tmux — prefer *-direct when truecolor, then *-256color, then screen-256color. # 5. tmux — prefer *-direct when truecolor, then *-256color, then screen-256color.
if [[ -z "$_candidate" && -n "${TMUX:-}" ]]; then if [[ -z "$_candidate" && -n "${TMUX:-}" ]]; then
if (( _truecolor )); then if (( _truecolor )); then
_term_has "tmux-direct" && _candidate="tmux-direct" _term_has "tmux-direct" && _candidate="tmux-direct"
[[ -z "$_candidate" ]] && _term_has "screen-direct" && _candidate="screen-direct" [[ -z "$_candidate" ]] && _term_has "screen-direct" && _candidate="screen-direct"
fi fi
[[ -z "$_candidate" ]] && _term_has "tmux-256color" && _candidate="tmux-256color" [[ -z "$_candidate" ]] && _term_has "tmux-256color" && _candidate="tmux-256color"
@@ -396,7 +399,7 @@ term_set()
# 6. GNU screen — prefer screen-direct when truecolor, then screen-256color. # 6. GNU screen — prefer screen-direct when truecolor, then screen-256color.
if [[ -z "$_candidate" && -n "${STY:-}" ]]; then if [[ -z "$_candidate" && -n "${STY:-}" ]]; then
if (( _truecolor )); then if (( _truecolor )); then
_term_has "screen-direct" && _candidate="screen-direct" _term_has "screen-direct" && _candidate="screen-direct"
fi fi
[[ -z "$_candidate" ]] && _term_has "screen-256color" && _candidate="screen-256color" [[ -z "$_candidate" ]] && _term_has "screen-256color" && _candidate="screen-256color"
[[ -z "$_candidate" ]] && _term_has "screen" && _candidate="screen" [[ -z "$_candidate" ]] && _term_has "screen" && _candidate="screen"