diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-14 21:19:04 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-14 21:19:04 +0000 |
commit | bc510064027da8024d59460c9c816aea4ffac096 (patch) | |
tree | 5054f5b794010b839bfec74808b369a726709f57 /src/ex_docmd.c | |
parent | 7a3b802bab5add34baae37ec2c1ae7ad2f1693bd (diff) | |
download | vim-git-bc510064027da8024d59460c9c816aea4ffac096.tar.gz |
patch 8.2.4384: Vim9: error message not tested, some code not testedv8.2.4384
Problem: Vim9: error message not tested, some code not tested.
Solution: Add a couple of test cases. Give an error for a command modifier
without a command.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 864f3d845..2cd2ca350 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2784,6 +2784,7 @@ parse_command_modifiers( { char_u *p; int starts_with_colon = FALSE; + int vim9script = in_vim9script(); CLEAR_POINTER(cmod); cmod->cmod_flags = sticky_cmdmod_flags; @@ -2819,12 +2820,18 @@ parse_command_modifiers( if (eap->nextcmd != NULL) ++eap->nextcmd; } + if (vim9script && has_cmdmod(cmod, FALSE)) + *errormsg = _(e_command_modifier_without_command); return FAIL; } if (*eap->cmd == NUL) { if (!skip_only) + { ex_pressedreturn = TRUE; + if (vim9script && has_cmdmod(cmod, FALSE)) + *errormsg = _(e_command_modifier_without_command); + } return FAIL; } @@ -2838,7 +2845,7 @@ parse_command_modifiers( // verbose[expr] = 2 // But not: // verbose [a, b] = list - if (in_vim9script()) + if (vim9script) { char_u *s, *n; @@ -2915,7 +2922,7 @@ parse_command_modifiers( #ifdef FEAT_EVAL // in ":filter #pat# cmd" # does not // start a comment - && (!in_vim9script() || VIM_ISWHITE(p[1])) + && (!vim9script || VIM_ISWHITE(p[1])) #endif )) break; @@ -2928,7 +2935,7 @@ parse_command_modifiers( } #ifdef FEAT_EVAL // Avoid that "filter(arg)" is recognized. - if (in_vim9script() && !VIM_ISWHITE(p[-1])) + if (vim9script && !VIM_ISWHITE(p[-1])) break; #endif if (skip_only) |