mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(cmdline): wrong 'incsearch' highlighting after :redraw (#27947)
Problem: Calling :redraw from a timer callback clears 'incsearch' highlighting. Solution: Re-apply 'incsearch' highlighting if the screen was updated.
This commit is contained in:
parent
7549845e8d
commit
c72d877c33
@ -1167,6 +1167,7 @@ static int command_line_execute(VimState *state, int key)
|
|||||||
return -1; // get another key
|
return -1; // get another key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disptick_T display_tick_saved = display_tick;
|
||||||
CommandLineState *s = (CommandLineState *)state;
|
CommandLineState *s = (CommandLineState *)state;
|
||||||
s->c = key;
|
s->c = key;
|
||||||
|
|
||||||
@ -1178,6 +1179,10 @@ static int command_line_execute(VimState *state, int key)
|
|||||||
} else {
|
} else {
|
||||||
map_execute_lua(false);
|
map_execute_lua(false);
|
||||||
}
|
}
|
||||||
|
// Re-apply 'incsearch' highlighting in case it was cleared.
|
||||||
|
if (display_tick > display_tick_saved && s->is_state.did_incsearch) {
|
||||||
|
may_do_incsearch_highlighting(s->firstc, s->count, &s->is_state);
|
||||||
|
}
|
||||||
|
|
||||||
// nvim_select_popupmenu_item() can be called from the handling of
|
// nvim_select_popupmenu_item() can be called from the handling of
|
||||||
// K_EVENT, K_COMMAND, or K_LUA.
|
// K_EVENT, K_COMMAND, or K_LUA.
|
||||||
|
@ -674,4 +674,18 @@ describe('search highlighting', function()
|
|||||||
:%g@a/b^ |
|
:%g@a/b^ |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('incsearch is still visible after :redraw from K_EVENT', function()
|
||||||
|
fn.setline(1, { 'foo', 'bar' })
|
||||||
|
feed('/foo<CR>/bar')
|
||||||
|
screen:expect([[
|
||||||
|
foo |
|
||||||
|
{3:bar} |
|
||||||
|
{1:~ }|*4
|
||||||
|
/bar^ |
|
||||||
|
]])
|
||||||
|
command('redraw!')
|
||||||
|
-- There is an intermediate state where :redraw! removes 'incsearch' highlight.
|
||||||
|
screen:expect_unchanged(true)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user