Skip to content

Commit 590aae3

Browse files
chrisbrabrammool
authored andcommitted
patch 9.0.1665: empty CmdlineEnter autocommand causes errors in Ex mode
Problem: Empty CmdlineEnter autocommand causes errors in Ex mode. Solution: Save and restore ex_pressedreturn. (Christian Brabandt, closes # 12581, closes #12578)
1 parent 8154e64 commit 590aae3

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/autocmd.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,6 @@ apply_autocmds_group(
20182018
int did_save_redobuff = FALSE;
20192019
save_redo_T save_redo;
20202020
int save_KeyTyped = KeyTyped;
2021-
int save_did_emsg;
20222021
ESTACK_CHECK_DECLARATION;
20232022

20242023
/*
@@ -2310,12 +2309,14 @@ apply_autocmds_group(
23102309
else
23112310
check_lnums_nested(TRUE);
23122311

2313-
save_did_emsg = did_emsg;
2312+
int save_did_emsg = did_emsg;
2313+
int save_ex_pressedreturn = get_pressedreturn();
23142314

23152315
do_cmdline(NULL, getnextac, (void *)&patcmd,
23162316
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
23172317

23182318
did_emsg += save_did_emsg;
2319+
set_pressedreturn(save_ex_pressedreturn);
23192320

23202321
if (nesting == 1)
23212322
// restore cursor and topline, unless they were changed

src/ex_docmd.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9840,7 +9840,6 @@ is_loclist_cmd(int cmdidx)
98409840
}
98419841
#endif
98429842

9843-
#if defined(FEAT_TIMERS) || defined(PROTO)
98449843
int
98459844
get_pressedreturn(void)
98469845
{
@@ -9852,4 +9851,3 @@ set_pressedreturn(int val)
98529851
{
98539852
ex_pressedreturn = val;
98549853
}
9855-
#endif

src/testdir/test_ex_mode.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ func Test_ex_mode_errors()
239239

240240
au! CmdLineEnter
241241
delfunc ExEnterFunc
242+
243+
au CmdlineEnter * :
244+
call feedkeys("gQecho 1\r", 'xt')
245+
246+
au! CmdlineEnter
247+
242248
quit
243249
endfunc
244250

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static char *(features[]) =
695695

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1665,
698700
/**/
699701
1664,
700702
/**/

0 commit comments

Comments
 (0)