• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisão639b1d6727573ea494311c8ec597850d6da1c20e (tree)
Hora2020-02-23 22:45:03
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Mensagem de Log

patch 8.2.0306: Vim9: :substitute(pat(repl does not work in Vim9 script

Commit: https://github.com/vim/vim/commit/83f37b91426b419a913aa4f42d041b2111b57864
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 23 14:35:01 2020 +0100

patch 8.2.0306: Vim9: :substitute(pat(repl does not work in Vim9 script
Problem: Vim9: :substitute(pat(repl does not work in Vim9 script.
Solution: Remember starting with a colon. (closes https://github.com/vim/vim/issues/5676)

Mudança Sumário

Diff

diff -r 53b0cee66935 -r 639b1d672757 src/ex_docmd.c
--- a/src/ex_docmd.c Sun Feb 23 13:45:04 2020 +0100
+++ b/src/ex_docmd.c Sun Feb 23 14:45:03 2020 +0100
@@ -1647,6 +1647,9 @@
16471647 int save_reg_executing = reg_executing;
16481648 int ni; // set when Not Implemented
16491649 char_u *cmd;
1650+#ifdef FEAT_EVAL
1651+ int starts_with_colon;
1652+#endif
16501653
16511654 vim_memset(&ea, 0, sizeof(ea));
16521655 ea.line1 = 1;
@@ -1689,6 +1692,7 @@
16891692 ea.cookie = cookie;
16901693 #ifdef FEAT_EVAL
16911694 ea.cstack = cstack;
1695+ starts_with_colon = *skipwhite(ea.cmd) == ':';
16921696 #endif
16931697 if (parse_command_modifiers(&ea, &errormsg, FALSE) == FAIL)
16941698 goto doend;
@@ -1713,7 +1717,7 @@
17131717 ea.cmd = skipwhite(ea.cmd + 1);
17141718
17151719 #ifdef FEAT_EVAL
1716- if (current_sctx.sc_version == SCRIPT_VERSION_VIM9)
1720+ if (current_sctx.sc_version == SCRIPT_VERSION_VIM9 && !starts_with_colon)
17171721 p = find_ex_command(&ea, NULL, lookup_scriptvar, NULL);
17181722 else
17191723 #endif
diff -r 53b0cee66935 -r 639b1d672757 src/testdir/test_vim9_script.vim
--- a/src/testdir/test_vim9_script.vim Sun Feb 23 13:45:04 2020 +0100
+++ b/src/testdir/test_vim9_script.vim Sun Feb 23 14:45:03 2020 +0100
@@ -580,6 +580,21 @@
580580 setline(1, 'something')
581581 :substitute(some(other(
582582 assert_equal('otherthing', getline(1))
583+ bwipe!
584+
585+ " also when the context is Vim9 script
586+ let lines =<< trim END
587+ vim9script
588+ new
589+ setline(1, 'something')
590+ :substitute(some(other(
591+ assert_equal('otherthing', getline(1))
592+ bwipe!
593+ END
594+ writefile(lines, 'Xvim9lines')
595+ source Xvim9lines
596+
597+ delete('Xvim9lines')
583598 enddef
584599
585600
diff -r 53b0cee66935 -r 639b1d672757 src/version.c
--- a/src/version.c Sun Feb 23 13:45:04 2020 +0100
+++ b/src/version.c Sun Feb 23 14:45:03 2020 +0100
@@ -739,6 +739,8 @@
739739 static int included_patches[] =
740740 { /* Add new patch number below this line */
741741 /**/
742+ 306,
743+/**/
742744 305,
743745 /**/
744746 304,
Show on old repository browser