summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-09-03 22:58:30 +0200
committerChristian Brabandt <cb@256bit.org>2024-09-03 22:58:30 +0200
commit2432b4a75321a1a9ac0f9b326c7e46d38bdb71bb (patch)
tree1f7f91c4a04e918e1fca348c072e488f4cae6402
parent3db32d2e7ffb4184c0996c1df6b9c09054074d26 (diff)
patch 9.1.0713: Newline causes E749 in Ex modev9.1.0713
Problem: Newline causes E749 in Ex mode (after 9.1.0573). Solution: Don't execute empty command followed by a newline. closes: #15614 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/ex_docmd.c5
-rw-r--r--src/testdir/test_ex_mode.vim16
-rw-r--r--src/version.c2
3 files changed, 23 insertions, 0 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 2a59301548..0e69d5c384 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2916,6 +2916,11 @@ parse_command_modifiers(
}
return FAIL;
}
+ if (eap->nextcmd == NULL && *eap->cmd == '\n')
+ {
+ eap->nextcmd = eap->cmd + 1;
+ return FAIL;
+ }
if (*eap->cmd == NUL)
{
if (!skip_only)
diff --git a/src/testdir/test_ex_mode.vim b/src/testdir/test_ex_mode.vim
index aa949355f4..19d0bece60 100644
--- a/src/testdir/test_ex_mode.vim
+++ b/src/testdir/test_ex_mode.vim
@@ -387,4 +387,20 @@ func Test_global_insert_newline()
bwipe!
endfunc
+" An empty command followed by a newline shouldn't cause E749 in Ex mode.
+func Test_ex_empty_command_newline()
+ let g:var = 0
+ call feedkeys("gQexecute \"\\nlet g:var = 1\"\r", 'xt')
+ call assert_equal(1, g:var)
+ call feedkeys("gQexecute \" \\nlet g:var = 2\"\r", 'xt')
+ call assert_equal(2, g:var)
+ call feedkeys("gQexecute \"\\t \\nlet g:var = 3\"\r", 'xt')
+ call assert_equal(3, g:var)
+ call feedkeys("gQexecute \"\\\"?!\\nlet g:var = 4\"\r", 'xt')
+ call assert_equal(4, g:var)
+ call feedkeys("gQexecute \" \\\"?!\\nlet g:var = 5\"\r", 'xt')
+ call assert_equal(5, g:var)
+ unlet g:var
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 1ba85a9c66..f53da01170 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 713,
+/**/
712,
/**/
711,