Mercurial > vim
comparison src/vim9compile.c @ 26404:1bbb884c8561 v8.2.3733
patch 8.2.3733: Vim9: using "legacy" before range does not work
Commit: https://github.com/vim/vim/commit/b579f6ebbfa826d228abec1e1b24c05894517c27
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 4 11:57:00 2021 +0000
patch 8.2.3733: Vim9: using "legacy" before range does not work
Problem: Vim9: using "legacy" before range does not work.
Solution: Skip over range before parsing command. (closes https://github.com/vim/vim/issues/9270)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 Dec 2021 13:00:05 +0100 |
parents | f5727e2603f0 |
children | 65ab0b035dd8 |
comparison
equal
deleted
inserted
replaced
26403:42c7018feb34 | 26404:1bbb884c8561 |
---|---|
9901 * 'text'->func() should not be confused with 'a mark | 9901 * 'text'->func() should not be confused with 'a mark |
9902 * "++nr" and "--nr" are eval commands | 9902 * "++nr" and "--nr" are eval commands |
9903 * in "$ENV->func()" the "$" is not a range | 9903 * in "$ENV->func()" the "$" is not a range |
9904 */ | 9904 */ |
9905 cmd = ea.cmd; | 9905 cmd = ea.cmd; |
9906 if (!(local_cmdmod.cmod_flags & CMOD_LEGACY) | 9906 if ((*cmd != '$' || starts_with_colon) |
9907 && (*cmd != '$' || starts_with_colon) | |
9908 && (starts_with_colon || !(*cmd == '\'' | 9907 && (starts_with_colon || !(*cmd == '\'' |
9909 || (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-'))))) | 9908 || (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-'))))) |
9910 { | 9909 { |
9911 ea.cmd = skip_range(ea.cmd, TRUE, NULL); | 9910 ea.cmd = skip_range(ea.cmd, TRUE, NULL); |
9912 if (ea.cmd > cmd) | 9911 if (ea.cmd > cmd) |
9913 { | 9912 { |
9914 if (!starts_with_colon) | 9913 if (!starts_with_colon |
9914 && !(local_cmdmod.cmod_flags & CMOD_LEGACY)) | |
9915 { | 9915 { |
9916 semsg(_(e_colon_required_before_range_str), cmd); | 9916 semsg(_(e_colon_required_before_range_str), cmd); |
9917 goto erret; | 9917 goto erret; |
9918 } | 9918 } |
9919 ea.addr_count = 1; | 9919 ea.addr_count = 1; |
9920 if (ends_excmd2(line, ea.cmd)) | 9920 if (ends_excmd2(line, ea.cmd)) |
9921 { | 9921 { |
9922 // A range without a command: jump to the line. | 9922 // A range without a command: jump to the line. |
9923 line = skipwhite(line); | |
9924 while (*line == ':') | |
9925 ++line; | |
9926 generate_EXEC(&cctx, ISN_EXECRANGE, | 9923 generate_EXEC(&cctx, ISN_EXECRANGE, |
9927 vim_strnsave(line, ea.cmd - line)); | 9924 vim_strnsave(cmd, ea.cmd - cmd)); |
9928 line = ea.cmd; | 9925 line = ea.cmd; |
9929 goto nextline; | 9926 goto nextline; |
9930 } | 9927 } |
9931 } | 9928 } |
9932 } | 9929 } |