summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-11-28 20:24:17 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-28 20:24:17 +0000
commit06bffe836c98a65d270579f08004503ffce9931c (patch)
treea3a4f948c6d97523bfa7128192af715f6d2c805c
parent3ccb5795168793e1b119a028da4035f77cef9f69 (diff)
downloadvim-git-8.2.3690.tar.gz
patch 8.2.3690: Vim9: "filter #pat# cmd" does not workv8.2.3690
Problem: Vim9: "filter #pat# cmd" does not work. Solution: Do not see #pat# as a comment.
-rw-r--r--src/ex_docmd.c9
-rw-r--r--src/testdir/test_vim9_cmd.vim10
-rw-r--r--src/version.c2
3 files changed, 20 insertions, 1 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index d74ef9026..6d2923ccb 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2910,7 +2910,14 @@ parse_command_modifiers(
int c = 0;
if (!checkforcmd_noparen(&p, "filter", 4)
- || *p == NUL || ends_excmd(*p))
+ || *p == NUL
+ || (ends_excmd(*p)
+#ifdef FEAT_EVAL
+ // in ":filter #pat# cmd" # does not
+ // start a comment
+ && (!in_vim9script() || VIM_ISWHITE(p[1]))
+#endif
+ ))
break;
if (*p == '!')
{
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim
index 7a05189db..57796b69b 100644
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -714,6 +714,16 @@ def Test_command_modifier_filter()
assert_match('very specific z3d37dh234 string', Screenline(&lines))
END
CheckDefAndScriptSuccess(lines)
+
+ lines =<< trim END
+ edit foobar
+ redir => g:filter_out
+ filter #foobar# ls
+ redir END
+ assert_match('"foobar"', g:filter_out)
+ unlet g:filter_out
+ END
+ CheckDefAndScriptSuccess(lines)
enddef
def Test_win_command_modifiers()
diff --git a/src/version.c b/src/version.c
index deefcf0c2..d7c2d6980 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3690,
+/**/
3689,
/**/
3688,