Skip to content

Downgrade $TERM warnings to a term-support flog#11290

Merged
faho merged 1 commit into
fish-shell:masterfrom
faho:no-warn-xterm
Mar 16, 2025
Merged

Downgrade $TERM warnings to a term-support flog#11290
faho merged 1 commit into
fish-shell:masterfrom
faho:no-warn-xterm

Conversation

@faho
Copy link
Copy Markdown
Member

@faho faho commented Mar 16, 2025

The chances that xterm-256color breaks anything are miniscule.

In the features we use, there are basically no differences, especially when you consider that we decode keys independently.

E.g. tmux-256color has differences, but they are either just taste questions (xterm's clear_screen will also clear scrollback), or they're just... not actually different?

Terminfo will claim that it uses a different cursor_up and exit_attribute_mode, but it also understands the xterm ones, and it sends a different key_home,
but we decode that even with TERM=xterm-256color.

In some cases, terminfo is also just outright wrong and will claim something does not support italics when it does.

So, since the differences are very likely to simply not matter, throwing a warning is more confusing than it is helpful.

TODOs:

  • [N/A] Changes to fish usage are reflected in user documentation/manpages.
  • [N/A] Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

I would like to include this in 4.0.2 because we've already had #11277, and that happened for at least two people. Even tho that was arguably a configuration error, the upshot is if we had just treated ghostty as xterm-256color literally nothing would have broken because there is no useful difference between these two for us.

I would actually go a step further and abolish our terminfo use altogether, but for that I would have to quantify just how many differences we have in practice, and that's hard because you need to throw away all the useless and sometimes outright wrong information terminfo gives you (e.g. the "konsole" terminfo entry is not used and does not document konsole's behavior, so you need to ignore it. some sequences like "cursor_normal" are sometimes equivalent but have their parts swapped, so infocmp will tell you there's a difference but it doesn't matter. tmux will understand xterm's sequences, so will screen (for the most part - but which parts exactly?). key_backspace is sometimes delete and sometimes ctrl-h but differs between terminals using the same TERM and can be configured).

So this is the next step.

The chances that xterm-256color breaks anything are miniscule.

In the features we use, there are basically no differences,
especially when you consider that we decode keys independently.

E.g. tmux-256color has differences, but they are either just taste
questions (xterm's clear_screen will also clear scrollback),
or they're just... not actually different?

Terminfo will claim that it uses a different cursor_up and
exit_attribute_mode, but it also understands the xterm ones,
and it sends a different key_home,
but we decode that even with TERM=xterm-256color.

In some cases, terminfo is also just outright *wrong* and will claim
something does not support italics when it does.

So, since the differences are very likely to simply not matter,
throwing a warning is more confusing than it is helpful.
@faho faho added this to the fish 4.0.2 milestone Mar 16, 2025
@krobelus
Copy link
Copy Markdown
Contributor

key_backspace is sometimes delete and sometimes ctrl-h but differs between terminals using the same TERM and can be configured).

for the default binding we use VERASE nowadays (which should obsolete the terminfo-backed bind -k backspace).

@faho faho merged commit 642ec39 into fish-shell:master Mar 16, 2025
@faho faho deleted the no-warn-xterm branch March 16, 2025 18:15
@faho
Copy link
Copy Markdown
Member Author

faho commented Mar 16, 2025

Cherry-picked to 4.0.2 as 76d2419

@faho
Copy link
Copy Markdown
Member Author

faho commented Mar 16, 2025

Here are the terminfo entries that have absolutely no difference compared to xterm-256color in the capabilities that we use:

alacritty foot ghostty hterm-256color rio xterm-256color xterm-ghostty

That's absolutely zero, not even useless swaps (cursor_normal: '\E[?12h\E[?25h', '\E[?12l\E[?25h'). Ignore those and add xterm-kitty.

if you ignore the sequences we only use to remove them from input (e.g. for width calculations), add contour and mintty.

And that's going by terminfo to begin with. If you discount keys (which we decode independently) and discount differences that aren't actually a difference in practice (i.e. the xterm sequence works or the feature isn't supported and it is ignored), you can add basically every single terminal in use, including tmux-256color, st-256color, rxvt-unicode-256color (but we do not currently decode those keys - I don't think anyone cares?). Even Eterm-256color (that's emacs' ansi-term) should be fine (it breaks due to things that don't have terminfo capabilities).

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants