]> granicus.if.org Git - vim/commitdiff
patch 8.2.2022: Vim9: star command recognized errornously v8.2.2022
authorBram Moolenaar <Bram@vim.org>
Fri, 20 Nov 2020 20:07:00 +0000 (21:07 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 20 Nov 2020 20:07:00 +0000 (21:07 +0100)
Problem:    Vim9: star command recognized errornously.
Solution:   Give an error for missing colon. (issue #7335)

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

index a6bdac3abaa5ce7240bbe67667d12ee5fe13646a..2c35c8ef21944439cc010d44873e03b6352a0bd7 100644 (file)
@@ -3482,6 +3482,11 @@ find_ex_command(
                break;
            }
 
+       // Not not recognize ":*" as the star command unless '*' is in
+       // 'cpoptions'.
+       if (eap->cmdidx == CMD_star && vim_strchr(p_cpo, CPO_STAR) == NULL)
+           p = eap->cmd;
+
        // Look for a user defined command as a last resort.  Let ":Print" be
        // overruled by a user defined command.
        if ((eap->cmdidx == CMD_SIZE || eap->cmdidx == CMD_Print)
index 0e6e94649e44022c7a5548acb0fca8190c8399c4..97110ce5272d79f300a9ef2fe84d74deb8120cde 100644 (file)
@@ -634,5 +634,19 @@ def Test_f_args()
   CheckScriptSuccess(lines)
 enddef
 
+def Test_star_command()
+  var lines =<< trim END
+    vim9script
+    @s = 'g:success = 8'
+    set cpo+=*
+    exe '*s'
+    assert_equal(8, g:success)
+    unlet g:success
+    set cpo-=*
+    assert_fails("exe '*s'", 'E1050:')
+  END
+  CheckScriptSuccess(lines)
+enddef
+
 
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
index aeadf361ad4f4eb036023f85f7ef914d1b5aa06c..303ecb3ee7c6f0f76b0458fbb6e4cdfb23bbde44 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2022,
 /**/
     2021,
 /**/