To: vim_dev@googlegroups.com Subject: Patch 8.2.0306 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0306 Problem: Vim9: :substitute(pat(repl does not work in Vim9 script. Solution: Remember starting with a colon. (closes #5676) Files: src/ex_docmd.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.0305/src/ex_docmd.c 2020-02-22 18:36:18.604483756 +0100 --- src/ex_docmd.c 2020-02-23 14:31:57.369013366 +0100 *************** *** 1647,1652 **** --- 1647,1655 ---- int save_reg_executing = reg_executing; int ni; // set when Not Implemented char_u *cmd; + #ifdef FEAT_EVAL + int starts_with_colon; + #endif vim_memset(&ea, 0, sizeof(ea)); ea.line1 = 1; *************** *** 1689,1694 **** --- 1692,1698 ---- ea.cookie = cookie; #ifdef FEAT_EVAL ea.cstack = cstack; + starts_with_colon = *skipwhite(ea.cmd) == ':'; #endif if (parse_command_modifiers(&ea, &errormsg, FALSE) == FAIL) goto doend; *************** *** 1713,1719 **** ea.cmd = skipwhite(ea.cmd + 1); #ifdef FEAT_EVAL ! if (current_sctx.sc_version == SCRIPT_VERSION_VIM9) p = find_ex_command(&ea, NULL, lookup_scriptvar, NULL); else #endif --- 1717,1723 ---- ea.cmd = skipwhite(ea.cmd + 1); #ifdef FEAT_EVAL ! if (current_sctx.sc_version == SCRIPT_VERSION_VIM9 && !starts_with_colon) p = find_ex_command(&ea, NULL, lookup_scriptvar, NULL); else #endif *** ../vim-8.2.0305/src/testdir/test_vim9_script.vim 2020-02-22 18:36:18.608483742 +0100 --- src/testdir/test_vim9_script.vim 2020-02-23 14:27:49.825770218 +0100 *************** *** 580,585 **** --- 580,600 ---- setline(1, 'something') :substitute(some(other( assert_equal('otherthing', getline(1)) + bwipe! + + " also when the context is Vim9 script + let lines =<< trim END + vim9script + new + setline(1, 'something') + :substitute(some(other( + assert_equal('otherthing', getline(1)) + bwipe! + END + writefile(lines, 'Xvim9lines') + source Xvim9lines + + delete('Xvim9lines') enddef *** ../vim-8.2.0305/src/version.c 2020-02-23 13:38:05.730666220 +0100 --- src/version.c 2020-02-23 14:29:11.781524858 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 306, /**/ -- hundred-and-one symptoms of being an internet addict: 102. When filling out your driver's license application, you give your IP address. /// 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 ///