]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1665: empty CmdlineEnter autocommand causes errors in Ex mode v9.0.1665
authorChristian Brabandt <cb@256bit.org>
Sun, 25 Jun 2023 21:34:22 +0000 (22:34 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 25 Jun 2023 21:34:22 +0000 (22:34 +0100)
Problem:    Empty CmdlineEnter autocommand causes errors in Ex mode.
Solution:   Save and restore ex_pressedreturn. (Christian Brabandt,
            closes # 12581, closes #12578)

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

index 862ddf7ccc9fab890c5778122835faaebec336a9..63e56735b5fea6802b25b91182775a4ef1f36b02 100644 (file)
@@ -2018,7 +2018,6 @@ apply_autocmds_group(
     int                did_save_redobuff = FALSE;
     save_redo_T        save_redo;
     int                save_KeyTyped = KeyTyped;
-    int                save_did_emsg;
     ESTACK_CHECK_DECLARATION;
 
     /*
@@ -2310,12 +2309,14 @@ apply_autocmds_group(
        else
            check_lnums_nested(TRUE);
 
-       save_did_emsg = did_emsg;
+       int save_did_emsg = did_emsg;
+       int save_ex_pressedreturn = get_pressedreturn();
 
        do_cmdline(NULL, getnextac, (void *)&patcmd,
                                     DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
 
        did_emsg += save_did_emsg;
+       set_pressedreturn(save_ex_pressedreturn);
 
        if (nesting == 1)
            // restore cursor and topline, unless they were changed
index 959331a0228740931e5a6346b29bd5f08f2f0322..8fda332688feb75d0bd01b7a6affc760d8cae84a 100644 (file)
@@ -9840,7 +9840,6 @@ is_loclist_cmd(int cmdidx)
 }
 #endif
 
-#if defined(FEAT_TIMERS) || defined(PROTO)
     int
 get_pressedreturn(void)
 {
@@ -9852,4 +9851,3 @@ set_pressedreturn(int val)
 {
      ex_pressedreturn = val;
 }
-#endif
index d03ec8f2d81dbeea606bcf16307ca90d30f0f3f7..59c28f3836187079ac7a82f3d3f8105f8fb08019 100644 (file)
@@ -239,6 +239,12 @@ func Test_ex_mode_errors()
 
   au! CmdLineEnter
   delfunc ExEnterFunc
+
+  au CmdlineEnter * :
+  call feedkeys("gQecho 1\r", 'xt')
+
+  au! CmdlineEnter
+
   quit
 endfunc
 
index 894b47d419761a6fa4d6af9a2197fc4625d14aae..9c451aef7ab5b90c6af8c49ae93d7b0a4637cfc0 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1665,
 /**/
     1664,
 /**/