diff options
| author | luukvbaal <luukvbaal@gmail.com> | 2026-04-22 15:04:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-22 13:04:20 +0000 |
| commit | 61fb88992d34d16b3058dcd8b1664f575449d964 (patch) | |
| tree | 998e8b6c6a2f64fbdfc9656a5079f7cc67cfd275 /src | |
| parent | 2ca31eddae0748de5d54207c2d34f7405fed4f29 (diff) | |
fix(cmdline): avoid 'incsearch' recursion after redraw #39303
Problem: A vim.ui_attach() callback that redraws to show a 'verbose'
regex message during 'incsearch' results in recusive redrawing.
Solution: Check that curwin was redrawn instead of just any window when
determining if 'incsearch' highlighting was cleared.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/buffer_defs.h | 1 | ||||
| -rw-r--r-- | src/nvim/drawscreen.c | 2 | ||||
| -rw-r--r-- | src/nvim/ex_getln.c | 4 |
3 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 72e67d4fd6..90845531f4 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1294,6 +1294,7 @@ struct window_S { bool w_redr_status; // if true statusline/winbar must be redrawn bool w_redr_border; // if true border must be redrawn bool w_redr_statuscol; // if true 'statuscolumn' must be redrawn + disptick_T w_display_tick; // when window was last drawn. // remember what is shown in the 'statusline'-format elements pos_T w_stl_cursor; // cursor position when last redrawn diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index 35f4691726..a7fa6bf688 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -2321,6 +2321,8 @@ redr_statuscol: wp->w_lines_valid = MAX(wp->w_lines_valid, idx); + wp->w_display_tick = display_tick; + // Let the syntax stuff know we stop parsing here. if (syntax_last_parsed != 0 && syntax_present(wp)) { syntax_end_parsing(wp, syntax_last_parsed + 1); diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 6cc697cc6e..5f384c6ee4 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1291,7 +1291,7 @@ static int command_line_execute(VimState *state, int key) return -1; // get another key } - disptick_T display_tick_saved = display_tick; + disptick_T display_tick_saved = curwin->w_display_tick; CommandLineState *s = (CommandLineState *)state; s->c = key; @@ -1322,7 +1322,7 @@ static int command_line_execute(VimState *state, int key) init_incsearch_state(&s->is_state); } // Re-apply 'incsearch' highlighting in case it was cleared. - if (display_tick > display_tick_saved && s->is_state.did_incsearch) { + if (curwin->w_display_tick > display_tick_saved && s->is_state.did_incsearch) { may_do_incsearch_highlighting(s->firstc, s->count, &s->is_state); } // If f_setcmdline() changed the cmdline treat it as such. |
