Skip to content

Commit ada1d87

Browse files
committed
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)
1 parent 10b9421 commit ada1d87

4 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/testdir/test_vim9_script.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3497,6 +3497,11 @@ def Test_unsupported_commands()
34973497
END
34983498
CheckDefAndScriptFailure(lines, 'E1100:')
34993499

3500+
lines =<< trim END
3501+
:1ka
3502+
END
3503+
CheckDefAndScriptFailure(lines, 'E481:')
3504+
35003505
lines =<< trim END
35013506
t
35023507
END

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2532,
753755
/**/
754756
2531,
755757
/**/

src/vim9compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8330,6 +8330,7 @@ compile_def_function(
83308330
semsg(_(e_colon_required_before_range_str), cmd);
83318331
goto erret;
83328332
}
8333+
ea.addr_count = 1;
83338334
if (ends_excmd2(line, ea.cmd))
83348335
{
83358336
// A range without a command: jump to the line.

src/vim9script.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,16 @@ not_in_vim9(exarg_T *eap)
9292
if (in_vim9script())
9393
switch (eap->cmdidx)
9494
{
95+
case CMD_k:
96+
if (eap->addr_count > 0)
97+
{
98+
emsg(_(e_norange));
99+
return FAIL;
100+
}
101+
// FALLTHROUGH
95102
case CMD_append:
96103
case CMD_change:
97104
case CMD_insert:
98-
case CMD_k:
99105
case CMD_t:
100106
case CMD_xit:
101107
semsg(_(e_command_not_supported_in_vim9_script_missing_var_str), eap->cmd);

0 commit comments

Comments
 (0)