diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-08-22 17:29:26 +0200 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2022-08-30 10:28:11 +0200 |
commit | 6ab2bf68196292721b71e096f45bfa3dd0192ee0 (patch) | |
tree | 25f28161692410ebf426df21a76820163138d101 | |
parent | 568737d5b39a4b58cab05d4edc2599653979770c (diff) | |
download | rneovim-6ab2bf68196292721b71e096f45bfa3dd0192ee0.tar.gz rneovim-6ab2bf68196292721b71e096f45bfa3dd0192ee0.tar.bz2 rneovim-6ab2bf68196292721b71e096f45bfa3dd0192ee0.zip |
fix(highlight): set the window namespace when redrawing statusline
-rw-r--r-- | src/nvim/drawscreen.c | 6 | ||||
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 45 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index 40dbec8a5b..29ff261461 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -748,6 +748,8 @@ void show_cursor_info(bool always) if (!always && !redrawing()) { return; } + + win_check_ns_hl(curwin); if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && (curwin->w_status_height || global_stl_height())) { redraw_custom_statusline(curwin); @@ -764,6 +766,7 @@ void show_cursor_info(bool always) maketitle(); } + win_check_ns_hl(NULL); // Redraw the tab pages line if needed. if (redraw_tabline) { draw_tabline(); @@ -2119,10 +2122,13 @@ void redraw_statuslines(void) { FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { if (wp->w_redr_status) { + win_check_ns_hl(wp); win_redr_winbar(wp); win_redr_status(wp); } } + + win_check_ns_hl(NULL); if (redraw_tabline) { draw_tabline(); } diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 4e3d62509c..5ffe9ddaad 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -2333,6 +2333,51 @@ describe("'winhighlight' highlight", function() helpers.assert_alive() end) + + it('can redraw statusline on cursor movement', function() + screen:try_resize(40, 8) + exec [[ + set statusline=%f%=%#Background1#%l,%c%V\ %P + split + ]] + insert [[ + some text + more text]] + screen:expect{grid=[[ + some text | + more tex^t | + {0:~ }| + {3:[No Name] }{1:2,9 All}| + some text | + more text | + {4:[No Name] }{1:1,1 All}| + | + ]]} + + command 'set winhl=Background1:Background2' + screen:expect{grid=[[ + some text | + more tex^t | + {0:~ }| + {3:[No Name] }{5:2,9 All}| + some text | + more text | + {4:[No Name] }{1:1,1 All}| + | + ]]} + + feed 'k' + screen:expect{grid=[[ + some tex^t | + more text | + {0:~ }| + {3:[No Name] }{5:1,9 All}| + some text | + more text | + {4:[No Name] }{1:1,1 All}| + | + ]]} + end) end) describe('highlight namespaces', function() |