detect termguicolor support in a terminal by chrisbra · Pull Request #16490 · vim/vim · GitHub
Skip to content

detect termguicolor support in a terminal - #16490

Closed
chrisbra wants to merge 1 commit into
vim:masterfrom
chrisbra:gh-16327
Closed

chrisbra wants to merge 1 commit into
vim:masterfrom
chrisbra:gh-16327

Conversation

@chrisbra

Copy link
Copy Markdown
Member

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)

Comment thread src/term.c Fixed
Comment thread src/term.c
@chrisbra
chrisbra force-pushed the gh-16327 branch 4 times, most recently from 4b65ad8 to 3b35f38 Compare January 25, 2025 14:10
chrisbra added a commit to chrisbra/vim that referenced this pull request Jan 25, 2025
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: vim#16327
closes: vim#16490

Signed-off-by: Christian Brabandt <cb@256bit.org>
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: vim#16327
closes: vim#16490

Signed-off-by: Christian Brabandt <cb@256bit.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants