fix(winbar): make setting WinBar and WinBarNC in 'winhighlight' work

This commit is contained in:
zeertzjq 2022-07-15 09:22:50 +08:00
parent 75ad050919
commit 8730643326
2 changed files with 33 additions and 3 deletions

View File

@ -5316,7 +5316,7 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
} }
fillchar = wp->w_p_fcs_chars.wbr; fillchar = wp->w_p_fcs_chars.wbr;
attr = (wp == curwin) ? HL_ATTR(HLF_WBR) : HL_ATTR(HLF_WBRNC); attr = (wp == curwin) ? win_hl_attr(wp, HLF_WBR) : win_hl_attr(wp, HLF_WBRNC);
maxwidth = wp->w_width_inner; maxwidth = wp->w_width_inner;
use_sandbox = was_set_insecurely(wp, "winbar", 0); use_sandbox = was_set_insecurely(wp, "winbar", 0);

View File

@ -1848,8 +1848,7 @@ describe("'winhighlight' highlight", function()
]], unchanged=true} ]], unchanged=true}
end) end)
it('works local to the window', function()
it('works local to the buffer', function()
insert("aa") insert("aa")
command("split") command("split")
command("setlocal winhl=Normal:Background1") command("setlocal winhl=Normal:Background1")
@ -2240,4 +2239,35 @@ describe("'winhighlight' highlight", function()
| |
]]} ]]}
end) end)
it('can override StatusLine and StatusLineNC', function()
command('set winhighlight=StatusLine:Background1,StatusLineNC:Background2')
command('split')
screen:expect([[
^ |
{0:~ }|
{0:~ }|
{1:[No Name] }|
|
{0:~ }|
{5:[No Name] }|
|
]])
end)
it('can override WinBar and WinBarNC #19345', function()
command('setlocal winbar=foobar')
command('set winhighlight=WinBar:Background1,WinBarNC:Background2')
command('split')
screen:expect([[
{1:foobar }|
^ |
{0:~ }|
{3:[No Name] }|
{5:foobar }|
|
{4:[No Name] }|
|
]])
end)
end) end)