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>
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 599f903..880ab0d 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -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 @@
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.
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index f77499a..e2243f6 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -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 @@
- 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 ~