patch 9.1.0713: Newline causes E749 in Ex mode Commit: https://github.com/vim/vim/commit/2432b4a75321a1a9ac0f9b326c7e46d38bdb71bb Author: zeertzjq <zeert...@outlook.com> Date: Tue Sep 3 22:58:30 2024 +0200
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 <zeert...@outlook.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 2a5930154..0e69d5c38 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 == ' ') + { + 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 aa949355f..19d0bece6 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\" ", 'xt') + call assert_equal(1, g:var) + call feedkeys("gQexecute \" \nlet g:var = 2\" ", 'xt') + call assert_equal(2, g:var) + call feedkeys("gQexecute \"\t \nlet g:var = 3\" ", 'xt') + call assert_equal(3, g:var) + call feedkeys("gQexecute \"\\"?!\nlet g:var = 4\" ", 'xt') + call assert_equal(4, g:var) + call feedkeys("gQexecute \" \\"?!\nlet g:var = 5\" ", '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 1ba85a9c6..f53da0117 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 713, /**/ 712, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sladC-009jhF-49%40256bit.org.