diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-11 21:10:14 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-12 19:13:28 -0400 |
commit | 73392909006de74e628323cde915b107244a247b (patch) | |
tree | e26c5b5aa90d01feb75aa87b575ab00972469dae | |
parent | d5b9a7d6e8891c8f456413b86ebfba44f92c713c (diff) | |
download | rneovim-73392909006de74e628323cde915b107244a247b.tar.gz rneovim-73392909006de74e628323cde915b107244a247b.tar.bz2 rneovim-73392909006de74e628323cde915b107244a247b.zip |
vim-patch:8.2.1000: get error when leaving Ex mode with :visual
Problem: Get error when leaving Ex mode with :visual and a CmdLineEnter
autocommand was used.
Solution: Reset ex_pressedreturn. (closes vim/vim#6293)
https://github.com/vim/vim/commit/158ea175a99fc23eae1b0a5ee9a81cdd973854a6
-rw-r--r-- | src/nvim/ex_docmd.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_ex_mode.vim | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 555029c1fb..87e482620c 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7305,6 +7305,7 @@ do_exedit( if (exmode_active && (eap->cmdidx == CMD_visual || eap->cmdidx == CMD_view)) { exmode_active = FALSE; + ex_pressedreturn = false; if (*eap->arg == NUL) { /* Special case: ":global/pat/visual\NLvi-commands" */ if (global_busy) { diff --git a/src/nvim/testdir/test_ex_mode.vim b/src/nvim/testdir/test_ex_mode.vim index 87c23a2fe8..f70cb261e0 100644 --- a/src/nvim/testdir/test_ex_mode.vim +++ b/src/nvim/testdir/test_ex_mode.vim @@ -54,3 +54,29 @@ func Test_ex_mode() set sw& let &encoding = encoding_save endfunc + +func Test_ex_mode_errors() + " Not allowed to enter ex mode when text is locked + au InsertCharPre <buffer> normal! gQ<CR> + let caught_e523 = 0 + try + call feedkeys("ix\<esc>", 'xt') + catch /^Vim\%((\a\+)\)\=:E523/ " catch E523 + let caught_e523 = 1 + endtry + call assert_equal(1, caught_e523) + au! InsertCharPre + + new + au CmdLineEnter * call ExEnterFunc() + func ExEnterFunc() + + endfunc + call feedkeys("gQvi\r", 'xt') + + au! CmdLineEnter + delfunc ExEnterFunc + quit +endfunc + +" vim: shiftwidth=2 sts=2 expandtab |