vim-patch:8.2.0274: hang with combination of feedkeys(), Ex mode and :global

Problem:    Hang with combination of feedkeys(), Ex mode and :global.
            (Yegappan Lakshmanan)
Solution:   Add the pending_exmode_active flag.
9e2bcb5d23
This commit is contained in:
zeertzjq
2022-07-08 21:04:45 +08:00
parent 45ba2e147f
commit 0d0a6aff6b
4 changed files with 19 additions and 0 deletions

View File

@@ -7899,9 +7899,11 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
need_wait_return = false; need_wait_return = false;
msg_scroll = 0; msg_scroll = 0;
redraw_all_later(NOT_VALID); redraw_all_later(NOT_VALID);
pending_exmode_active = true;
normal_enter(false, true); normal_enter(false, true);
pending_exmode_active = false;
RedrawingDisabled = rd; RedrawingDisabled = rd;
no_wait_return = nwr; no_wait_return = nwr;
msg_scroll = ms; msg_scroll = ms;

View File

@@ -2475,6 +2475,11 @@ static int vgetorpeek(bool advance)
} }
tc = c; tc = c;
// return 0 in normal_check()
if (pending_exmode_active) {
exmode_active = true;
}
// no chars to block abbreviations for // no chars to block abbreviations for
typebuf.tb_no_abbr_cnt = 0; typebuf.tb_no_abbr_cnt = 0;

View File

@@ -636,6 +636,10 @@ EXTERN int motion_force INIT(=0); // motion force for pending operator
// Ex Mode (Q) state // Ex Mode (Q) state
EXTERN bool exmode_active INIT(= false); // true if Ex mode is active EXTERN bool exmode_active INIT(= false); // true if Ex mode is active
/// Flag set when normal_check() should return 0 when entering Ex mode.
EXTERN bool pending_exmode_active INIT(= false);
EXTERN bool ex_no_reprint INIT(=false); // No need to print after z or p. EXTERN bool ex_no_reprint INIT(=false); // No need to print after z or p.
// 'inccommand' command preview state // 'inccommand' command preview state

View File

@@ -64,6 +64,14 @@ func Test_ex_mode()
let &encoding = encoding_save let &encoding = encoding_save
endfunc endfunc
func Test_Ex_feedkeys()
" this doesn't do anything useful, just check it doesn't hang
new
call setline(1, ["foo"])
call feedkeys("Qg/foo/visual\<CR>", "xt")
bwipe!
endfunc
func Test_ex_mode_errors() func Test_ex_mode_errors()
" Not allowed to enter ex mode when text is locked " Not allowed to enter ex mode when text is locked
au InsertCharPre <buffer> normal! gQ<CR> au InsertCharPre <buffer> normal! gQ<CR>