feat(defaults): enable 'termguicolors' by default when supported by terminal#26407
feat(defaults): enable 'termguicolors' by default when supported by terminal#26407gpanders merged 2 commits intoneovim:masterfrom
Conversation
|
I can confirm that stock |
|
Would it reduce potential "flicker" if we actually make this the hardcoded default? Line 8762 in 1fd29a2 So the detection logic is used to disable the default, if necessary. But the common case is that 'tgc' is enabled and don't need to redo its side-effects. |
| --- OSC 11 ; rgba:<red>/<green>/<blue>/<alpha> | ||
| --- | ||
| --- where | ||
| if tty then |
There was a problem hiding this comment.
Probably a good time to introduce a _tui.lua or _tty.lua file, since we will be adding more and more TUI stuff here.
99bda5b to
7a7f72a
Compare
Either way it has no effect on the flicker. But I agree that
Maybe. For now all of this stuff is still just part of "defaults" though. |
|
While updating the tests in |
Actually, I need to think about this more. This gets tricky in the case that
|
But if it's already enabled, why do we need to set it again? And conversely, if the user disabled it, we can skip/ignore all of our detection stuff. |
We disable it if we can't tell that the terminal emulator supports truecolor (i.e. when Keeping the hardcoded default EDIT: EDIT 2: No, that won't work, because all Lua scripts have the same SID (-8).
The detection stuff runs before any user config files, so it's not possible for the user to set it before that happens. We have to check if the user has disabled it when the responses to our terminal queries arrive. |
|
Reverting the hardcoded default back to |
48ccc00 to
4e18634
Compare
…erminal Enable 'termguicolors' automatically when Nvim can detect that truecolor is supported by the host terminal. If $COLORTERM is set to "truecolor" or "24bit", or the terminal's terminfo entry contains capabilities for Tc, RGB, or setrgbf and setrgbb, then we assume that the terminal supports truecolor. Otherwise, the terminal is queried (using both XTGETTCAP and SGR + DECRQSS). If the terminal's response to these queries (if any) indicates that it supports truecolor, then 'termguicolors' is enabled.
2765071 to
5c7a01f
Compare
|
Last failing test: But this fails for me on master as well. EDIT: To clarify, this fails for me on master on macOS. I can't reproduce the failure on Linux on this branch, with any build options. |
bd15be7 to
db7f119
Compare
Set 'notermguicolors' in tests which spawn a child Nvim process to force existing tests to use 16 colors. Also refactor the child process invocation to make things a little bit less messy.
|
Great work on the turnaround time for this! |
|
This test is failing about 40% of the time now: |
[1] implelements terminal trucolors capability detection and sets `'termguicolors'` if supported. [1]: neovim/neovim#26407
Enable
'termguicolors'automatically when Nvim can detect that truecolor is supported by the host terminal.If
$COLORTERMis set to "truecolor" or "24bit", or the terminal's terminfo entry contains capabilities for Tc, RGB, or setrgbf and setrgbb, then we assume that the terminal supports truecolor. Otherwise, the terminal is queried (using both XTGETTCAP and SGR + DECRQSS). If the terminal's response to these queries (if any) indicates that it supports truecolor, then'termguicolors'is enabled.This follows the process documented in https://github.com/termstandard/colors#checking-for-colorterm.
Experimental/test results:
'termguicolors'is correctly set on:All of the terminal emulators listed above set
$COLORTERM, so'termguicolors'support is assumed from that. If we explicitly unset$COLORTERMand forceTERM=xterm-256color(mimicking an SSH session lacking proper terminfo, for instance), the results are all still correct except for Alacritty, which does not includeTc,RGB,setrgbf, orsetrgbbin its terminfo and does not support XTGETTCAP or DECRQSS.'termguicolors'is correctly not set on:I was not able to directly test foot or Xterm. I'm confident foot will work. Xterm should work since it parses DECRQSS (and I even bent over backwards to ensure we parse Xterm's DECRQSS response, since it differs from everyone else's).