Mercurial > vim
changeset 20897:213fb059e02e v8.2.1000
patch 8.2.1000: get error when leaving Ex mode with :visual
Commit: https://github.com/vim/vim/commit/158ea175a99fc23eae1b0a5ee9a81cdd973854a6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 18 17:28:39 2020 +0200
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 #6293)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 18 Jun 2020 17:30:03 +0200 |
parents | 9df2164fcd19 |
children | d3cd1a4d18e2 |
files | src/ex_docmd.c src/testdir/test_ex_mode.vim src/version.c |
diffstat | 3 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1895,7 +1895,7 @@ do_one_cmd( p = ea.cmd; while (ASCII_ISALNUM(*p)) ++p; - p = vim_strnsave(ea.cmd, (int)(p - ea.cmd)); + p = vim_strnsave(ea.cmd, p - ea.cmd); ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL); vim_free(p); // If the autocommands did something and didn't cause an error, try @@ -6215,6 +6215,7 @@ do_exedit( || eap->cmdidx == CMD_view)) { exmode_active = FALSE; + ex_pressedreturn = FALSE; if (*eap->arg == NUL) { // Special case: ":global/pat/visual\NLvi-commands"
--- a/src/testdir/test_ex_mode.vim +++ b/src/testdir/test_ex_mode.vim @@ -166,6 +166,17 @@ func Test_ex_mode_errors() endtry call assert_equal(1, caught_e565) 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