Mercurial > vim
diff src/ex_docmd.c @ 22772:82a7aff951d2 v8.2.1934
patch 8.2.1934: Vim9: command modifiers in :def function not tested
Commit: https://github.com/vim/vim/commit/e88c8e802cf5ee59a2a6649a5b46c9e80de823ad
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 1 17:03:37 2020 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Nov 2020 17:15:06 +0100 |
parents | f945413264d7 |
children | 44317eb799d7 |
line wrap: on
line diff
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -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"