]> granicus.if.org Git - vim/commitdiff
patch 8.2.1000: get error when leaving Ex mode with :visual v8.2.1000
authorBram Moolenaar <Bram@vim.org>
Thu, 18 Jun 2020 15:28:39 +0000 (17:28 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 18 Jun 2020 15:28:39 +0000 (17:28 +0200)
Problem:    Get error when leaving Ex mode with :visual and a CmdLineEnter
            autocommand was used.
Solution:   Reset ex_pressedreturn. (closes #6293)

src/ex_docmd.c
src/testdir/test_ex_mode.vim
src/version.c

index 3a1a61491b71528fe55d303b33e1ba43a697b68a..93f33ae429f5fb95a863c80293b81f48a9d86093 100644 (file)
@@ -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"
index d23e0ad9317bc0a0b05b062f47888c769aa9e343..32c65448f4902acc267a66aaa6b3b488ccdaadc9 100644 (file)
@@ -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
index f1cc22f5e5bda400f3e2b3661bc1b2a499a2bc65..5f4ff7172ac8c58058eac833ba5495805e89ef68 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1000,
 /**/
     999,
 /**/