Mercurial > vim
changeset 36090:f5735e754951 v9.1.0713
patch 9.1.0713: Newline causes E749 in Ex mode
Commit: https://github.com/vim/vim/commit/2432b4a75321a1a9ac0f9b326c7e46d38bdb71bb
Author: zeertzjq <zeertzjq@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 <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 03 Sep 2024 23:00:06 +0200 |
parents | 31192cbe014d |
children | 9566fc76fd3a |
files | src/ex_docmd.c src/testdir/test_ex_mode.vim src/version.c |
diffstat | 3 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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