1
0
forked from aniani/vim

patch 9.1.0713: Newline causes E749 in Ex mode

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>
This commit is contained in:
zeertzjq
2024-09-03 22:58:30 +02:00
committed by Christian Brabandt
parent 3db32d2e7f
commit 2432b4a753
3 changed files with 23 additions and 0 deletions

View File

@@ -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)

View File

@@ -387,4 +387,20 @@ func Test_global_insert_newline()
func Test_global_insert_newline()
new
call setline(1, ['foo'])
call feedkeys("Qg/foo/i\\\n", "xt")
call assert_equal(['', 'foo'], getline(1, '$'))
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')

View File

@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
713,
/**/
712,
/**/