diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index f3eb5d410d..36f0183fd8 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -1784,11 +1784,13 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force } const int save_did_emsg = did_emsg; + const bool save_ex_pressedreturn = get_pressedreturn(); // Execute the autocmd. The `getnextac` callback handles iteration. do_cmdline(NULL, getnextac, &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 diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim index 3332bc6ab9..42f08868a0 100644 --- a/test/old/testdir/test_ex_mode.vim +++ b/test/old/testdir/test_ex_mode.vim @@ -244,6 +244,12 @@ func Test_ex_mode_errors() au! CmdLineEnter delfunc ExEnterFunc + + au CmdlineEnter * : + call feedkeys("gQecho 1\r", 'xt') + + au! CmdlineEnter + quit endfunc