vim-patch:8.2.1983: ml_get error when using <Cmd> to open a terminal (#34759)

Problem:    ml_get error when using <Cmd> to open a terminal.
Solution:   If the window changed reset the incsearch state. (closes vim/vim#7289)

f4d61bc559

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2025-07-04 15:30:34 +08:00
committed by GitHub
parent 16001b4d84
commit 3694fcec28
2 changed files with 32 additions and 0 deletions

View File

@ -104,6 +104,7 @@ typedef struct {
typedef struct {
pos_T search_start; // where 'incsearch' starts searching
pos_T save_cursor;
handle_T winid; // window where this state is valid
viewstate_T init_viewstate;
viewstate_T old_viewstate;
pos_T match_start;
@ -257,6 +258,7 @@ static void restore_viewstate(win_T *wp, viewstate_T *vs)
static void init_incsearch_state(incsearch_state_T *s)
{
s->winid = curwin->handle;
s->match_start = curwin->w_cursor;
s->did_incsearch = false;
s->incsearch_postponed = false;
@ -1214,6 +1216,10 @@ static int command_line_execute(VimState *state, int key)
} else {
map_execute_lua(false);
}
// If the window changed incremental search state is not valid.
if (s->is_state.winid != curwin->handle) {
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) {
may_do_incsearch_highlighting(s->firstc, s->count, &s->is_state);