diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-11-14 14:22:28 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-11-14 14:22:28 +0100 |
commit | f4d61bc559f8cb6adc4880183a4fd216865c0c30 (patch) | |
tree | 8eea642340fa2386f81208c97956522706d4907e /src/ex_getln.c | |
parent | 2ce7790348dab9cbfcc5d02c8258d0dd7ecacf95 (diff) | |
download | vim-git-f4d61bc559f8cb6adc4880183a4fd216865c0c30.tar.gz |
patch 8.2.1983: ml_get error when using <Cmd> to open a terminalv8.2.1983
Problem: ml_get error when using <Cmd> to open a terminal.
Solution: If the window changed reset the incsearch state. (closes #7289)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index a00d6deb3..80a920486 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -142,6 +142,7 @@ restore_viewstate(viewstate_T *vs) typedef struct { pos_T search_start; // where 'incsearch' starts searching pos_T save_cursor; + int winid; // window where this state is valid viewstate_T init_viewstate; viewstate_T old_viewstate; pos_T match_start; @@ -154,6 +155,7 @@ typedef struct { static void init_incsearch_state(incsearch_state_T *is_state) { + is_state->winid = curwin->w_id; is_state->match_start = curwin->w_cursor; is_state->did_incsearch = FALSE; is_state->incsearch_postponed = FALSE; @@ -1703,13 +1705,13 @@ getcmdline_int( // Trigger SafeState if nothing is pending. may_trigger_safestate(xpc.xp_numfiles <= 0); - cursorcmd(); // set the cursor on the right spot - // Get a character. Ignore K_IGNORE and K_NOP, they should not do // anything, such as stop completion. do + { + cursorcmd(); // set the cursor on the right spot c = safe_vgetc(); - while (c == K_IGNORE || c == K_NOP); + } while (c == K_IGNORE || c == K_NOP); if (c == K_COMMAND && do_cmdline(NULL, getcmdkeycmd, NULL, DOCMD_NOWAIT) == OK) @@ -2327,6 +2329,11 @@ cmdline_not_changed: #endif cmdline_changed: +#ifdef FEAT_SEARCH_EXTRA + // If the window changed incremental search state is not valid. + if (is_state.winid != curwin->w_id) + init_incsearch_state(&is_state); +#endif // Trigger CmdlineChanged autocommands. trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED); |