diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-15 09:22:50 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-15 09:22:57 +0800 |
commit | 8730643326618bae4a0f7ff90489fa8238fe7c81 (patch) | |
tree | 2b392fad853f38c0a7f2031de1e094ec33ccea24 | |
parent | 75ad050919b1d27f90b5e6332b9d446529c7cb31 (diff) | |
download | rneovim-8730643326618bae4a0f7ff90489fa8238fe7c81.tar.gz rneovim-8730643326618bae4a0f7ff90489fa8238fe7c81.tar.bz2 rneovim-8730643326618bae4a0f7ff90489fa8238fe7c81.zip |
fix(winbar): make setting WinBar and WinBarNC in 'winhighlight' work
-rw-r--r-- | src/nvim/screen.c | 2 | ||||
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 34 |
2 files changed, 33 insertions, 3 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 9e545fbbf5..de837720c1 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -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; - 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; use_sandbox = was_set_insecurely(wp, "winbar", 0); diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 22589fb107..e065a727f3 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -1848,8 +1848,7 @@ describe("'winhighlight' highlight", function() ]], unchanged=true} end) - - it('works local to the buffer', function() + it('works local to the window', function() insert("aa") command("split") command("setlocal winhl=Normal:Background1") @@ -2240,4 +2239,35 @@ describe("'winhighlight' highlight", function() | ]]} 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) |