From 34e271b32111cca3245283b7f9de2fe821982510 Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Tue, 31 Dec 2024 10:46:22 +0100 Subject: [PATCH] runtime(doc): use standard SGR format at :h xterm-true-color By default, Vim uses the non-standard, but widely supported, legacy xterm/Konsole format for setting "direct colors" with set setaf and setbf escape codes, which use semicolons as separators. The documentation for xterm-true-color mentions that, as an alternative, users can set alternative sequences that use colons instead of semicolons. This format, though, isn't standard and it is unclear how widely supported it is; it was added by xterm patch 282 due to a misinterpretation of the ISO 8613-6 (ITU T.416) standard, and was later changed to the format suggested by this patch, which is the one specified in the standard. Today, looking at ncurses' [terminfo], it seems that all terminal emulators use either the standard format (named "xterm+direct" in the terminfo source) or the legacy format (named "xterm+indirect" in the terminfo source). Hence, I believe it makes sense to align the docs with reality. If you're interested in the story of this escape sequence, I'd recommend reading . [terminfo]: https://invisible-island.net/ncurses/terminfo.ti.html closes: #16350 Signed-off-by: Christian Brabandt Signed-off-by: Andrea Pappacoda --- runtime/doc/term.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index d930dd33e0..f56dbd4b6d 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 9.1. Last change: 2024 Oct 05 +*term.txt* For Vim version 9.1. Last change: 2024 Dec 31 VIM REFERENCE MANUAL by Bram Moolenaar @@ -688,10 +688,11 @@ The default values are set like this: > let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[48;2;%lu;%lu;%lum" -Some terminals accept the same sequences, but with all semicolons replaced by -colons (this is actually more compatible, but less widely supported): > - let &t_8f = "\[38:2:%lu:%lu:%lum" - let &t_8b = "\[48:2:%lu:%lu:%lum" +Some terminals accept similar sequences, with semicolons replaced by colons +and an extra colon after the number 2 (this is conformant to the ISO 8613-6 +standard, but less widely supported): > + let &t_8f = "\[38:2::%lu:%lu:%lum" + let &t_8b = "\[48:2::%lu:%lu:%lum" These options contain printf strings, with |printf()| (actually, its C equivalent hence `l` modifier) invoked with the t_ option value and three