diff options
-rw-r--r-- | src/nvim/screen.c | 4 | ||||
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 18 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index a3ec6e26a2..4146ae0fe3 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -451,9 +451,11 @@ int update_screen(int type) // reset cmdline_row now (may have been changed temporarily) compute_cmdrow(); + bool hl_changed = false; // Check for changed highlighting if (need_highlight_changed) { highlight_changed(); + hl_changed = true; } if (type == CLEAR) { // first clear screen @@ -554,7 +556,7 @@ int update_screen(int type) * buffer. Each buffer must only be done once. */ FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { - update_window_hl(wp, type >= NOT_VALID); + update_window_hl(wp, type >= NOT_VALID || hl_changed); buf_T *buf = wp->w_buffer; if (buf->b_mod_set) { diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index c00d30fe32..0983d0d4ad 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -276,6 +276,24 @@ describe('highlight defaults', function() ]], {[0] = {bold=true, foreground=Screen.colors.Blue}}) end) + it('linking updates window highlight immediately #16552', function() + screen:try_resize(53, 4) + screen:expect([[ + ^ | + {0:~ }| + {0:~ }| + | + ]], {[0] = {bold=true, foreground=Screen.colors.Blue}}) + feed_command("hi NonTextAlt guifg=Red") + feed_command("hi! link NonText NonTextAlt") + screen:expect([[ + ^ | + {0:~ }| + {0:~ }| + :hi! link NonText NonTextAlt | + ]], {[0] = {foreground=Screen.colors.Red}}) + end) + it('Cursor after `:hi clear|syntax reset` #6508', function() command('highlight clear|syntax reset') eq('guifg=bg guibg=fg', eval([[matchstr(execute('hi Cursor'), '\v(gui|cterm).*$')]])) |