patch 8.2.2955: Vim9: using filter in compiled command does not work
Problem: Vim9: using filter in compiled command does not work.
Solution: Generate EXEC including the command modifier.
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index fbf2c7d..4aaccb5 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2881,7 +2881,9 @@
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 @@
p = skip_vimgrep_pat(p, NULL, NULL);
else
// NOTE: This puts a NUL after the pattern.
- p = skip_vimgrep_pat(p, ®_pat, NULL);
+ p = skip_vimgrep_pat_ext(p, ®_pat, NULL,
+ &nulp, &c);
if (p == NULL || *p == NUL)
break;
if (!skip_only)
@@ -2911,6 +2914,9 @@
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;