neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 0d0a6aff6b89e2f48455b7f2f88e0b25d0a2080d
parent 45ba2e147f7b7d17acb489d64acc257ceded0887
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Fri,  8 Jul 2022 21:04:45 +0800

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.
https://github.com/vim/vim/commit/9e2bcb5d23138d45a0b6f9c1542b5facc807efe7

Diffstat:
Msrc/nvim/ex_docmd.c | 2++
Msrc/nvim/getchar.c | 5+++++
Msrc/nvim/globals.h | 4++++
Msrc/nvim/testdir/test_ex_mode.vim | 8++++++++
4 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c @@ -7899,9 +7899,11 @@ void do_exedit(exarg_T *eap, win_T *old_curwin) need_wait_return = false; msg_scroll = 0; redraw_all_later(NOT_VALID); + pending_exmode_active = true; normal_enter(false, true); + pending_exmode_active = false; RedrawingDisabled = rd; no_wait_return = nwr; msg_scroll = ms; diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c @@ -2475,6 +2475,11 @@ static int vgetorpeek(bool advance) } tc = c; + // return 0 in normal_check() + if (pending_exmode_active) { + exmode_active = true; + } + // no chars to block abbreviations for typebuf.tb_no_abbr_cnt = 0; diff --git a/src/nvim/globals.h b/src/nvim/globals.h @@ -636,6 +636,10 @@ EXTERN int motion_force INIT(=0); // motion force for pending operator // Ex Mode (Q) state 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. // 'inccommand' command preview state diff --git a/src/nvim/testdir/test_ex_mode.vim b/src/nvim/testdir/test_ex_mode.vim @@ -64,6 +64,14 @@ func Test_ex_mode() let &encoding = encoding_save 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() " Not allowed to enter ex mode when text is locked au InsertCharPre <buffer> normal! gQ<CR>