]> granicus.if.org Git - vim/commitdiff
patch 8.2.3690: Vim9: "filter #pat# cmd" does not work v8.2.3690
authorBram Moolenaar <Bram@vim.org>
Sun, 28 Nov 2021 20:24:17 +0000 (20:24 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 28 Nov 2021 20:24:17 +0000 (20:24 +0000)
Problem:    Vim9: "filter #pat# cmd" does not work.
Solution:   Do not see #pat# as a comment.

src/ex_docmd.c
src/testdir/test_vim9_cmd.vim
src/version.c

index d74ef90263f66f535611474060bbcf86237ea99c..6d2923ccb2518b16d487256b767e1d17dc00ed86 100644 (file)
@@ -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 == '!')
                            {
index 7a05189db8816c91a3f0f52aaacc9530f3813b6f..57796b69beee17e8246b7857ca89ba39a8a3b724 100644 (file)
@@ -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()
index deefcf0c2fe22bb6934d5689c1f92507ec5d9b3e..d7c2d698018f2d12c65ffc279654aa9a221477ec 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3690,
 /**/
     3689,
 /**/