To: vim_dev@googlegroups.com Subject: Patch 8.2.1500 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1500 Problem: Vim9: error when using address without a command. Solution: Execute the range itself. (closes #6747) Files: src/vim9compile.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.1499/src/vim9compile.c 2020-08-20 18:02:42.715595020 +0200 --- src/vim9compile.c 2020-08-20 22:51:59.087039844 +0200 *************** *** 6661,6670 **** if (*cmd != '\'' || starts_with_colon) { ea.cmd = skip_range(ea.cmd, NULL); ! if (ea.cmd > cmd && !starts_with_colon) { ! emsg(_(e_colon_required_before_a_range)); ! goto erret; } } p = find_ex_command(&ea, NULL, starts_with_colon ? NULL --- 6661,6682 ---- if (*cmd != '\'' || starts_with_colon) { ea.cmd = skip_range(ea.cmd, NULL); ! if (ea.cmd > cmd) { ! if (!starts_with_colon) ! { ! emsg(_(e_colon_required_before_a_range)); ! goto erret; ! } ! if (ends_excmd2(line, ea.cmd)) ! { ! // A range without a command: jump to the line. ! // TODO: compile to a more efficient command, possibly ! // calling parse_cmd_address(). ! ea.cmdidx = CMD_SIZE; ! line = compile_exec(line, &ea, &cctx); ! goto nextline; ! } } } p = find_ex_command(&ea, NULL, starts_with_colon ? NULL *************** *** 6845,6850 **** --- 6857,6863 ---- line = compile_exec(line, &ea, &cctx); break; } + nextline: if (line == NULL) goto erret; line = skipwhite(line); *** ../vim-8.2.1499/src/testdir/test_vim9_script.vim 2020-08-20 15:02:38.540534948 +0200 --- src/testdir/test_vim9_script.vim 2020-08-20 22:59:22.960925294 +0200 *************** *** 10,15 **** --- 10,22 ---- let other: list = ['asdf'] enddef + def Test_range_only() + new + setline(1, ['blah', 'Blah']) + :/Blah/ + assert_equal(2, getcurpos()[1]) + enddef + let s:appendToMe = 'xxx' let s:addToMe = 111 let g:existing = 'yes' *** ../vim-8.2.1499/src/version.c 2020-08-20 22:29:05.449693697 +0200 --- src/version.c 2020-08-20 23:02:49.464190953 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1500, /**/ -- hundred-and-one symptoms of being an internet addict: 253. You wait for a slow loading web page before going to the toilet. /// 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 ///