From 95388e3179f6b995dbc4acd3f23e3856bb0286fd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 20 Nov 2020 21:07:00 +0100 Subject: patch 8.2.2022: Vim9: star command recognized errornously Problem: Vim9: star command recognized errornously. Solution: Give an error for missing colon. (issue #7335) --- src/ex_docmd.c | 5 +++++ src/testdir/test_vim9_cmd.vim | 14 ++++++++++++++ src/version.c | 2 ++ 3 files changed, 21 insertions(+) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index a6bdac3ab..2c35c8ef2 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -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) diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim index 0e6e94649..97110ce52 100644 --- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -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 diff --git a/src/version.c b/src/version.c index aeadf361a..303ecb3ee 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2022, /**/ 2021, /**/ -- cgit v1.2.1