summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-04 11:57:00 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-04 11:57:00 +0000
commitb579f6ebbfa826d228abec1e1b24c05894517c27 (patch)
tree97f9c2ade59a7794af2104b27ab87457410891e4 /src/vim9compile.c
parentcd2f8f0e0007bb77fc2035e6ad6227bb6661c612 (diff)
downloadvim-git-b579f6ebbfa826d228abec1e1b24c05894517c27.tar.gz
patch 8.2.3733: Vim9: using "legacy" before range does not workv8.2.3733
Problem: Vim9: using "legacy" before range does not work. Solution: Skip over range before parsing command. (closes #9270)
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 70cf0b4e9..52e5ac8cc 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -9903,15 +9903,15 @@ compile_def_function(
* in "$ENV->func()" the "$" is not a range
*/
cmd = ea.cmd;
- if (!(local_cmdmod.cmod_flags & CMOD_LEGACY)
- && (*cmd != '$' || starts_with_colon)
+ if ((*cmd != '$' || starts_with_colon)
&& (starts_with_colon || !(*cmd == '\''
|| (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-')))))
{
ea.cmd = skip_range(ea.cmd, TRUE, NULL);
if (ea.cmd > cmd)
{
- if (!starts_with_colon)
+ if (!starts_with_colon
+ && !(local_cmdmod.cmod_flags & CMOD_LEGACY))
{
semsg(_(e_colon_required_before_range_str), cmd);
goto erret;
@@ -9920,11 +9920,8 @@ compile_def_function(
if (ends_excmd2(line, ea.cmd))
{
// A range without a command: jump to the line.
- line = skipwhite(line);
- while (*line == ':')
- ++line;
generate_EXEC(&cctx, ISN_EXECRANGE,
- vim_strnsave(line, ea.cmd - line));
+ vim_strnsave(cmd, ea.cmd - cmd));
line = ea.cmd;
goto nextline;
}