mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
screen: winhl=Normal:Background should not override syntax (#8093)
fixes #7375
This commit is contained in:
parent
cb5cde6e2b
commit
60e96a45b4
@ -2044,7 +2044,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
|
|||||||
}
|
}
|
||||||
|
|
||||||
screen_line(row + wp->w_winrow, wp->w_wincol, wp->w_width,
|
screen_line(row + wp->w_winrow, wp->w_wincol, wp->w_width,
|
||||||
wp->w_width, false, wp);
|
wp->w_width, false, wp, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update w_cline_height and w_cline_folded if the cursor line was
|
* Update w_cline_height and w_cline_folded if the cursor line was
|
||||||
@ -2465,10 +2465,6 @@ win_line (
|
|||||||
line_attr = win_hl_attr(wp, HLF_QFL);
|
line_attr = win_hl_attr(wp, HLF_QFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp->w_hl_attr_normal != 0) {
|
|
||||||
line_attr = hl_combine_attr(wp->w_hl_attr_normal, line_attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line_attr != 0) {
|
if (line_attr != 0) {
|
||||||
area_highlighting = true;
|
area_highlighting = true;
|
||||||
}
|
}
|
||||||
@ -2926,7 +2922,8 @@ win_line (
|
|||||||
&& lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol
|
&& lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol
|
||||||
&& filler_todo <= 0
|
&& filler_todo <= 0
|
||||||
) {
|
) {
|
||||||
screen_line(screen_row, wp->w_wincol, col, -wp->w_width, wp->w_p_rl, wp);
|
screen_line(screen_row, wp->w_wincol, col, -wp->w_width, wp->w_p_rl, wp,
|
||||||
|
wp->w_hl_attr_normal);
|
||||||
// Pretend we have finished updating the window. Except when
|
// Pretend we have finished updating the window. Except when
|
||||||
// 'cursorcolumn' is set.
|
// 'cursorcolumn' is set.
|
||||||
if (wp->w_p_cuc) {
|
if (wp->w_p_cuc) {
|
||||||
@ -4019,7 +4016,8 @@ win_line (
|
|||||||
col++;
|
col++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screen_line(screen_row, wp->w_wincol, col, wp->w_width, wp->w_p_rl, wp);
|
screen_line(screen_row, wp->w_wincol, col, wp->w_width, wp->w_p_rl, wp,
|
||||||
|
wp->w_hl_attr_normal);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4242,7 +4240,7 @@ win_line (
|
|||||||
|| (n_extra != 0 && (c_extra != NUL || *p_extra != NUL)))
|
|| (n_extra != 0 && (c_extra != NUL || *p_extra != NUL)))
|
||||||
) {
|
) {
|
||||||
screen_line(screen_row, wp->w_wincol, col - boguscols,
|
screen_line(screen_row, wp->w_wincol, col - boguscols,
|
||||||
wp->w_width, wp->w_p_rl, wp);
|
wp->w_width, wp->w_p_rl, wp, wp->w_hl_attr_normal);
|
||||||
boguscols = 0;
|
boguscols = 0;
|
||||||
++row;
|
++row;
|
||||||
++screen_row;
|
++screen_row;
|
||||||
@ -4412,7 +4410,7 @@ static int char_needs_redraw(int off_from, int off_to, int cols)
|
|||||||
* When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width"
|
* When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width"
|
||||||
*/
|
*/
|
||||||
static void screen_line(int row, int coloff, int endcol,
|
static void screen_line(int row, int coloff, int endcol,
|
||||||
int clear_width, int rlflag, win_T *wp)
|
int clear_width, int rlflag, win_T *wp, int bg_attr)
|
||||||
{
|
{
|
||||||
unsigned off_from;
|
unsigned off_from;
|
||||||
unsigned off_to;
|
unsigned off_to;
|
||||||
@ -4445,15 +4443,16 @@ static void screen_line(int row, int coloff, int endcol,
|
|||||||
/* Clear rest first, because it's left of the text. */
|
/* Clear rest first, because it's left of the text. */
|
||||||
if (clear_width > 0) {
|
if (clear_width > 0) {
|
||||||
while (col <= endcol && ScreenLines[off_to] == ' '
|
while (col <= endcol && ScreenLines[off_to] == ' '
|
||||||
&& ScreenAttrs[off_to] == 0
|
&& ScreenAttrs[off_to] == bg_attr
|
||||||
&& (!enc_utf8 || ScreenLinesUC[off_to] == 0)
|
&& (!enc_utf8 || ScreenLinesUC[off_to] == 0)
|
||||||
) {
|
) {
|
||||||
++off_to;
|
++off_to;
|
||||||
++col;
|
++col;
|
||||||
}
|
}
|
||||||
if (col <= endcol)
|
if (col <= endcol) {
|
||||||
screen_fill(row, row + 1, col + coloff,
|
screen_fill(row, row + 1, col + coloff, endcol + coloff + 1, ' ', ' ',
|
||||||
endcol + coloff + 1, ' ', ' ', 0);
|
bg_attr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
col = endcol + 1;
|
col = endcol + 1;
|
||||||
off_to = LineOffset[row] + col + coloff;
|
off_to = LineOffset[row] + col + coloff;
|
||||||
@ -4461,6 +4460,13 @@ static void screen_line(int row, int coloff, int endcol,
|
|||||||
endcol = (clear_width > 0 ? clear_width : -clear_width);
|
endcol = (clear_width > 0 ? clear_width : -clear_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bg_attr) {
|
||||||
|
for (int c = col; c < endcol; c++) {
|
||||||
|
ScreenAttrs[off_from+c] = hl_combine_attr(bg_attr,
|
||||||
|
ScreenAttrs[off_from+c]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
redraw_next = char_needs_redraw(off_from, off_to, endcol - col);
|
redraw_next = char_needs_redraw(off_from, off_to, endcol - col);
|
||||||
|
|
||||||
while (col < endcol) {
|
while (col < endcol) {
|
||||||
@ -4559,15 +4565,15 @@ static void screen_line(int row, int coloff, int endcol,
|
|||||||
|
|
||||||
/* blank out the rest of the line */
|
/* blank out the rest of the line */
|
||||||
while (col < clear_width && ScreenLines[off_to] == ' '
|
while (col < clear_width && ScreenLines[off_to] == ' '
|
||||||
&& ScreenAttrs[off_to] == 0
|
&& ScreenAttrs[off_to] == bg_attr
|
||||||
&& (!enc_utf8 || ScreenLinesUC[off_to] == 0)
|
&& (!enc_utf8 || ScreenLinesUC[off_to] == 0)
|
||||||
) {
|
) {
|
||||||
++off_to;
|
++off_to;
|
||||||
++col;
|
++col;
|
||||||
}
|
}
|
||||||
if (col < clear_width) {
|
if (col < clear_width) {
|
||||||
screen_fill(row, row + 1, col + coloff, clear_width + coloff,
|
screen_fill(row, row + 1, col + coloff, clear_width + coloff, ' ', ' ',
|
||||||
' ', ' ', 0);
|
bg_attr);
|
||||||
off_to += clear_width - col;
|
off_to += clear_width - col;
|
||||||
col = clear_width;
|
col = clear_width;
|
||||||
}
|
}
|
||||||
|
@ -778,6 +778,9 @@ describe("'winhighlight' highlight", function()
|
|||||||
[22] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
[22] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||||
[23] = {background = Screen.colors.LightMagenta},
|
[23] = {background = Screen.colors.LightMagenta},
|
||||||
[24] = {background = Screen.colors.WebGray},
|
[24] = {background = Screen.colors.WebGray},
|
||||||
|
[25] = {bold = true, foreground = Screen.colors.Green1},
|
||||||
|
[26] = {background = Screen.colors.Red},
|
||||||
|
[27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1},
|
||||||
})
|
})
|
||||||
command("hi Background1 guibg=DarkBlue")
|
command("hi Background1 guibg=DarkBlue")
|
||||||
command("hi Background2 guibg=DarkGreen")
|
command("hi Background2 guibg=DarkGreen")
|
||||||
@ -1047,6 +1050,39 @@ describe("'winhighlight' highlight", function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("background doesn't override syntax background", function()
|
||||||
|
command('syntax on')
|
||||||
|
command('syntax keyword Foobar foobar')
|
||||||
|
command('syntax keyword Article the')
|
||||||
|
command('hi Foobar guibg=#FF0000')
|
||||||
|
command('hi Article guifg=#00FF00 gui=bold')
|
||||||
|
insert('the foobar was foobar')
|
||||||
|
screen:expect([[
|
||||||
|
{25:the} {26:foobar} was {26:fooba}|
|
||||||
|
{26:^r} |
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- winhl=Normal:Group with background doesn't override syntax background,
|
||||||
|
-- but does combine with syntax foreground.
|
||||||
|
command('set winhl=Normal:Background1')
|
||||||
|
screen:expect([[
|
||||||
|
{27:the}{1: }{26:foobar}{1: was }{26:fooba}|
|
||||||
|
{26:^r}{1: }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
{2:~ }|
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
it('can override NonText, Conceal and EndOfBuffer', function()
|
it('can override NonText, Conceal and EndOfBuffer', function()
|
||||||
curbufmeths.set_lines(0,-1,true, {"raa\000"})
|
curbufmeths.set_lines(0,-1,true, {"raa\000"})
|
||||||
command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
|
command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
|
||||||
|
Loading…
Reference in New Issue
Block a user