Mirror of the Vim source from https://github.com/vim/vim
Revisão | 639b1d6727573ea494311c8ec597850d6da1c20e (tree) |
---|---|
Hora | 2020-02-23 22:45:03 |
Autor | Bram Moolenaar <Bram@vim....> |
Commiter | Bram Moolenaar |
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
@@ -1647,6 +1647,9 @@ | ||
1647 | 1647 | int save_reg_executing = reg_executing; |
1648 | 1648 | int ni; // set when Not Implemented |
1649 | 1649 | char_u *cmd; |
1650 | +#ifdef FEAT_EVAL | |
1651 | + int starts_with_colon; | |
1652 | +#endif | |
1650 | 1653 | |
1651 | 1654 | vim_memset(&ea, 0, sizeof(ea)); |
1652 | 1655 | ea.line1 = 1; |
@@ -1689,6 +1692,7 @@ | ||
1689 | 1692 | ea.cookie = cookie; |
1690 | 1693 | #ifdef FEAT_EVAL |
1691 | 1694 | ea.cstack = cstack; |
1695 | + starts_with_colon = *skipwhite(ea.cmd) == ':'; | |
1692 | 1696 | #endif |
1693 | 1697 | if (parse_command_modifiers(&ea, &errormsg, FALSE) == FAIL) |
1694 | 1698 | goto doend; |
@@ -1713,7 +1717,7 @@ | ||
1713 | 1717 | ea.cmd = skipwhite(ea.cmd + 1); |
1714 | 1718 | |
1715 | 1719 | #ifdef FEAT_EVAL |
1716 | - if (current_sctx.sc_version == SCRIPT_VERSION_VIM9) | |
1720 | + if (current_sctx.sc_version == SCRIPT_VERSION_VIM9 && !starts_with_colon) | |
1717 | 1721 | p = find_ex_command(&ea, NULL, lookup_scriptvar, NULL); |
1718 | 1722 | else |
1719 | 1723 | #endif |
@@ -580,6 +580,21 @@ | ||
580 | 580 | setline(1, 'something') |
581 | 581 | :substitute(some(other( |
582 | 582 | 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') | |
583 | 598 | enddef |
584 | 599 | |
585 | 600 |
@@ -739,6 +739,8 @@ | ||
739 | 739 | static int included_patches[] = |
740 | 740 | { /* Add new patch number below this line */ |
741 | 741 | /**/ |
742 | + 306, | |
743 | +/**/ | |
742 | 744 | 305, |
743 | 745 | /**/ |
744 | 746 | 304, |