0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.2215: Vim9: not recognized in global command

Problem:    Vim9:  not recognized in global command.
Solution:   Skip over pattern. (issue #7541)
This commit is contained in:
Bram Moolenaar
2020-12-25 18:35:29 +01:00
parent f8103f274e
commit 56ce9ea3ea
3 changed files with 25 additions and 1 deletions

View File

@@ -25,6 +25,15 @@ def Test_edit_wildcards()
CheckDefFailure(['edit `="foo"'], 'E1083:') CheckDefFailure(['edit `="foo"'], 'E1083:')
enddef enddef
def Test_global_backtick_expansion()
new
setline(1, 'xx')
var name = 'foobar'
g/^xx/s/.*/`=name`
assert_equal('foobar', getline(1))
bwipe!
enddef
def Test_hardcopy_wildcards() def Test_hardcopy_wildcards()
CheckUnix CheckUnix
CheckFeature postscript CheckFeature postscript

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2215,
/**/ /**/
2214, 2214,
/**/ /**/

View File

@@ -2947,7 +2947,7 @@ compile_list(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
} }
/* /*
* parse a lambda: {arg, arg -> expr} * parse a lambda: "{arg, arg -> expr}" or "(arg, arg) => expr"
* "*arg" points to the '{'. * "*arg" points to the '{'.
*/ */
static int static int
@@ -7315,6 +7315,19 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
eap->arg = skiptowhite(eap->arg); eap->arg = skiptowhite(eap->arg);
} }
if ((eap->cmdidx == CMD_global || eap->cmdidx == CMD_vglobal)
&& STRLEN(eap->arg) > 4)
{
int delim = *eap->arg;
p = skip_regexp_ex(eap->arg + 1, delim, TRUE, NULL, NULL);
if (*p == delim)
{
eap->arg = p + 1;
has_expr = TRUE;
}
}
if (has_expr && (p = (char_u *)strstr((char *)eap->arg, "`=")) != NULL) if (has_expr && (p = (char_u *)strstr((char *)eap->arg, "`=")) != NULL)
{ {
int count = 0; int count = 0;