patch 9.1.1054: Vim doesn't work well with TERM=xterm-direct

Problem:  Vim doesn't work well with TERM=xterm-direct
          (Andrea Pappacoda)
Solution: detect if a terminal supports true-colors and
          enable termguicolors

The terminfo database for xterm-direct contains both the (non-standard)
termcap RGB capability and a number of colors == 0x1000000 so it seems
either of those two options can be used to detect a terminal capable of
displaying true colors.

So set the termguicolor option automatically, when either of the two
options is detected. (for some reasons, my debian xterm (v393) does not
respond to XTGETTCAP query attempts, so falling back to the number of
colors seems like a good compromize)

fixes: #16327
closes: #16490

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2025-01-26 10:49:59 +01:00
parent fb49e3cde7
commit 279dd703e1
5 changed files with 85 additions and 10 deletions

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 9.1. Last change: 2025 Jan 23
*options.txt* For Vim version 9.1. Last change: 2025 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@ -8501,6 +8501,11 @@ A jump table for the options with a short description can be found at |Q_op|.
When on, uses |highlight-guifg| and |highlight-guibg| attributes in
the terminal (thus using 24-bit color).
Will automatically be enabled, if Vim detects that it runs in a
capable terminal (when the terminal supports the RGB terminfo
capability or when the number of colors |t_Co| supported by the
terminal is 0x1000000, e.g. with $TERM=xterm-direct).
Requires a ISO-8613-3 compatible terminal. If setting this option
does not work (produces a colorless UI) reading |xterm-true-color|
might help.

View File

@ -1,4 +1,4 @@
*version9.txt* For Vim version 9.1. Last change: 2025 Jan 25
*version9.txt* For Vim version 9.1. Last change: 2025 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@ -41628,6 +41628,8 @@ Changed~
- New option value "nosort" for 'completeopt'
- add |dist#vim9#Launch()| and |dist#vim9#Open()| to the |vim-script-library|
and decouple it from |netrw|
- 'termguicolors' is automatically enabled if the terminal supports the RGB
terminfo capability or supports 0x1000000 colors
*added-9.2*
Added ~