To: vim_dev@googlegroups.com Subject: Patch 8.2.2532 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2532 Problem: Vim9: confusing error if :k is used with a range. Solution: Give an error about the range. (issue #7874) Files: src/vim9script.c, src/vim9compile.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.2531/src/vim9script.c 2021-02-19 21:42:51.544789771 +0100 --- src/vim9script.c 2021-02-20 08:07:26.245153413 +0100 *************** *** 92,101 **** if (in_vim9script()) switch (eap->cmdidx) { 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); --- 92,107 ---- 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_t: case CMD_xit: semsg(_(e_command_not_supported_in_vim9_script_missing_var_str), eap->cmd); *** ../vim-8.2.2531/src/vim9compile.c 2021-02-19 21:42:51.544789771 +0100 --- src/vim9compile.c 2021-02-20 08:14:08.555862542 +0100 *************** *** 8330,8335 **** --- 8330,8336 ---- 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. *** ../vim-8.2.2531/src/testdir/test_vim9_script.vim 2021-02-19 21:42:51.544789771 +0100 --- src/testdir/test_vim9_script.vim 2021-02-20 08:09:35.048756445 +0100 *************** *** 3498,3503 **** --- 3498,3508 ---- CheckDefAndScriptFailure(lines, 'E1100:') lines =<< trim END + :1ka + END + CheckDefAndScriptFailure(lines, 'E481:') + + lines =<< trim END t END CheckDefFailure(lines, 'E1100:') *** ../vim-8.2.2531/src/version.c 2021-02-19 21:42:51.544789771 +0100 --- src/version.c 2021-02-20 08:06:10.257387987 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2532, /**/ -- The war between Emacs and Vi is over. Vi has won with 3 to 1. http://m.linuxjournal.com/files/linuxjournal.com/linuxjournal/articles/030/3044/3044s1.html /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///