if (ea.cmd == cmd + 1 && *cmd == '$')
// should be "$VAR = val"
--ea.cmd;
- else if (ea.cmd > cmd)
+ p = find_ex_command(&ea, NULL, lookup_scriptvar, NULL);
+ if (ea.cmdidx == CMD_SIZE)
{
- emsg(_(e_colon_required_before_a_range));
- goto doend;
+ char_u *ar = skip_range(ea.cmd, TRUE, NULL);
+
+ // If a ':' before the range is missing, give a clearer error
+ // message.
+ if (ar > ea.cmd)
+ {
+ emsg(_(e_colon_required_before_a_range));
+ goto doend;
+ }
}
- p = find_ex_command(&ea, NULL, lookup_scriptvar, NULL);
}
else
#endif
# verbose
enddef
+def Test_range_after_command_modifier()
+ CheckScriptFailure(['vim9script', 'silent keepjump 1d _'], 'E1050:', 2)
+ new
+ setline(1, 'xxx')
+ CheckScriptSuccess(['vim9script', 'silent keepjump :1d _'])
+ assert_equal('', getline(1))
+ bwipe!
+enddef
+
def Test_eval_command()
var from = 3
var to = 5