0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.2532: Vim9: confusing error if :k is used with a range

Problem:    Vim9: confusing error if :k is used with a range.
Solution:   Give an error about the range. (issue #7874)
This commit is contained in:
Bram Moolenaar 2021-02-20 08:16:51 +01:00
parent 10b9421f3b
commit ada1d870b4
4 changed files with 15 additions and 1 deletions

View File

@ -3497,6 +3497,11 @@ def Test_unsupported_commands()
END END
CheckDefAndScriptFailure(lines, 'E1100:') CheckDefAndScriptFailure(lines, 'E1100:')
lines =<< trim END
:1ka
END
CheckDefAndScriptFailure(lines, 'E481:')
lines =<< trim END lines =<< trim END
t t
END END

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2532,
/**/ /**/
2531, 2531,
/**/ /**/

View File

@ -8330,6 +8330,7 @@ compile_def_function(
semsg(_(e_colon_required_before_range_str), cmd); semsg(_(e_colon_required_before_range_str), cmd);
goto erret; goto erret;
} }
ea.addr_count = 1;
if (ends_excmd2(line, ea.cmd)) if (ends_excmd2(line, ea.cmd))
{ {
// A range without a command: jump to the line. // A range without a command: jump to the line.

View File

@ -92,10 +92,16 @@ not_in_vim9(exarg_T *eap)
if (in_vim9script()) if (in_vim9script())
switch (eap->cmdidx) switch (eap->cmdidx)
{ {
case CMD_k:
if (eap->addr_count > 0)
{
emsg(_(e_norange));
return FAIL;
}
// FALLTHROUGH
case CMD_append: case CMD_append:
case CMD_change: case CMD_change:
case CMD_insert: case CMD_insert:
case CMD_k:
case CMD_t: case CMD_t:
case CMD_xit: case CMD_xit:
semsg(_(e_command_not_supported_in_vim9_script_missing_var_str), eap->cmd); semsg(_(e_command_not_supported_in_vim9_script_missing_var_str), eap->cmd);