1
0
forked from aniani/vim

patch 9.1.0068: Visual highlighting can still be improved

Problem:  Visual highlighting can still be improved
Solution: Update Visual highlighting for 8 color terminals,
          use uniform grey highlighting for dark and light bg
          (Maxim Kim)

Update terminal Visual

1. Use `ctermbg=Grey ctermfg=Black` for both dark and light

This uniforms Visual highlighting between default dark and light colors
And should work for vim usually detecting light background for terminals
with black/dark background colors.

Previously used `ctermfg=White` leaks `cterm=bold` if available colors
are less than 16.

2. Use `term=reverse cterm=reverse ctermbg=NONE ctermfg=NONE`
   for terminals reporting less than 8 colors available

If the terminal has less than 8 colors, grey just doesn't work right

closes: #13940

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Maxim Kim
2024-02-01 21:07:51 +01:00
committed by Christian Brabandt
parent e1cd1fda69
commit 59bafc8171
40 changed files with 83 additions and 78 deletions

View File

@@ -221,8 +221,8 @@ static char *(highlight_init_light[]) = {
CENT("SignColumn term=standout ctermbg=Grey ctermfg=DarkBlue",
"SignColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue"),
#endif
CENT("Visual ctermbg=DarkGrey ctermfg=White",
"Visual ctermbg=DarkGrey ctermfg=White guibg=LightGrey"),
CENT("Visual ctermbg=Grey ctermfg=Black",
"Visual ctermbg=Grey ctermfg=Black guibg=LightGrey"),
#ifdef FEAT_DIFF
CENT("DiffAdd term=bold ctermbg=LightBlue",
"DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue"),
@@ -433,8 +433,11 @@ init_highlight(
for (i = 0; pp[i] != NULL; ++i)
do_highlight((char_u *)pp[i], reset, TRUE);
// Reverse looks ugly, but grey may not work for 8 colors. Thus let it
// depend on the number of colors available.
// Reverse looks ugly, but grey may not work for less than 8 colors. Thus
// let it depend on the number of colors available.
if (t_colors < 8)
do_highlight((char_u *)"Visual term=reverse cterm=reverse ctermbg=NONE ctermfg=NONE",
FALSE, TRUE);
// With 8 colors brown is equal to yellow, need to use black for Search fg
// to avoid Statement highlighted text disappears.
// Clear the attributes, needed when changing the t_Co value.