Mercurial > vim
changeset 23980:bee8c78c0c6a v8.2.2532
patch 8.2.2532: Vim9: confusing error if :k is used with a range
Commit: https://github.com/vim/vim/commit/ada1d870b4a818151cfba1c18962af2369b88df9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 20 08:16:51 2021 +0100
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 https://github.com/vim/vim/issues/7874)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 20 Feb 2021 08:30:03 +0100 |
parents | 9e16ae5f8ff8 |
children | 05c1a8485fb9 |
files | src/testdir/test_vim9_script.vim src/version.c src/vim9compile.c src/vim9script.c |
diffstat | 4 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -3498,6 +3498,11 @@ def Test_unsupported_commands() CheckDefAndScriptFailure(lines, 'E1100:') lines =<< trim END + :1ka + END + CheckDefAndScriptFailure(lines, 'E481:') + + lines =<< trim END t END CheckDefFailure(lines, 'E1100:')
--- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2532, +/**/ 2531, /**/ 2530,
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -8330,6 +8330,7 @@ compile_def_function( semsg(_(e_colon_required_before_range_str), cmd); goto erret; } + ea.addr_count = 1; if (ends_excmd2(line, ea.cmd)) { // A range without a command: jump to the line.
--- a/src/vim9script.c +++ b/src/vim9script.c @@ -92,10 +92,16 @@ not_in_vim9(exarg_T *eap) if (in_vim9script()) switch (eap->cmdidx) { + case CMD_k: + if (eap->addr_count > 0) + { + emsg(_(e_norange)); + return FAIL; + } + // FALLTHROUGH case CMD_append: case CMD_change: case CMD_insert: - case CMD_k: case CMD_t: case CMD_xit: semsg(_(e_command_not_supported_in_vim9_script_missing_var_str), eap->cmd);