summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-06 21:38:09 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-06 21:38:09 +0200
commite729ce294f9756165020ad86e3b98b4112e1a6ab (patch)
tree9bfd11d59b2a6e1592dc7ee8dc8a7f4d943631ac /src/ex_docmd.c
parent6db7b6375a3ea3afef5295b1366896902012e640 (diff)
patch 8.2.2955: Vim9: using filter in compiled command does not workv8.2.2955
Problem: Vim9: using filter in compiled command does not work. Solution: Generate EXEC including the command modifier.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index fbf2c7d0dd..4aaccb593f 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2881,7 +2881,9 @@ parse_command_modifiers(
case 'f': // only accept ":filter {pat} cmd"
{
- char_u *reg_pat;
+ char_u *reg_pat;
+ char_u *nulp = NULL;
+ int c = 0;
if (!checkforcmd_noparen(&p, "filter", 4)
|| *p == NUL || ends_excmd(*p))
@@ -2902,7 +2904,8 @@ parse_command_modifiers(
p = skip_vimgrep_pat(p, NULL, NULL);
else
// NOTE: This puts a NUL after the pattern.
- p = skip_vimgrep_pat(p, &reg_pat, NULL);
+ p = skip_vimgrep_pat_ext(p, &reg_pat, NULL,
+ &nulp, &c);
if (p == NULL || *p == NUL)
break;
if (!skip_only)
@@ -2911,6 +2914,9 @@ parse_command_modifiers(
vim_regcomp(reg_pat, RE_MAGIC);
if (cmod->cmod_filter_regmatch.regprog == NULL)
break;
+ // restore the character overwritten by NUL
+ if (nulp != NULL)
+ *nulp = c;
}
eap->cmd = p;
continue;