1
0
forked from aniani/vim

patch 8.2.1934: Vim9: command modifiers in :def function not tested

Problem:    Vim9: command modifiers in :def function not tested.
Solution:   Add tests.  Fix using modifier before filter command.
This commit is contained in:
Bram Moolenaar
2020-11-01 17:03:37 +01:00
parent 55e29611d2
commit e88c8e802c
4 changed files with 160 additions and 8 deletions

View File

@@ -1782,14 +1782,27 @@ do_one_cmd(
*/
cmd = ea.cmd;
#ifdef FEAT_EVAL
// In Vim9 script a colon is required before the range.
may_have_range = !vim9script || starts_with_colon;
// In Vim9 script a colon is required before the range. This may also be
// after command modifiers.
if (vim9script)
{
may_have_range = FALSE;
for (p = ea.cmd; p >= *cmdlinep; --p)
{
if (*p == ':')
may_have_range = TRUE;
if (p < ea.cmd && !VIM_ISWHITE(*p))
break;
}
}
else
may_have_range = TRUE;
if (may_have_range)
#endif
ea.cmd = skip_range(ea.cmd, TRUE, NULL);
#ifdef FEAT_EVAL
if (vim9script && !starts_with_colon)
if (vim9script && !may_have_range)
{
if (ea.cmd == cmd + 1 && *cmd == '$')
// should be "$VAR = val"