diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-06-20 12:40:08 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-06-20 12:40:08 +0200 |
commit | 208f0b48b2c616b29f377a1408290111ed2663f7 (patch) | |
tree | 14bd8d18340129cc7d6b0ea0a42d7e5d806a401f /src | |
parent | 2fb749568662c86992aea3b596458b9e470f223d (diff) | |
download | vim-git-208f0b48b2c616b29f377a1408290111ed2663f7.tar.gz |
patch 8.2.3021: spaces allowed between option name and "!", "?", etc.v8.2.3021
Problem: Spaces allowed between option name and "!", "?", etc.
Solution: Disallow spaces in Vim9 script, it was not documented.
(closes #8408)
Diffstat (limited to 'src')
-rw-r--r-- | src/option.c | 7 | ||||
-rw-r--r-- | src/testdir/test_vim9_script.vim | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 26 insertions, 3 deletions
diff --git a/src/option.c b/src/option.c index dd44fe4ac..535213c19 100644 --- a/src/option.c +++ b/src/option.c @@ -1306,9 +1306,10 @@ do_set( // remember character after option name afterchar = arg[len]; - // skip white space, allow ":set ai ?" - while (VIM_ISWHITE(arg[len])) - ++len; + if (!in_vim9script()) + // skip white space, allow ":set ai ?", ":set hlsearch !" + while (VIM_ISWHITE(arg[len])) + ++len; adding = FALSE; prepending = FALSE; diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index 4b0ab2bad..1584f173a 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -3937,6 +3937,26 @@ def Test_mapping_line_number() delfunc g:FuncA enddef +def Test_option_modifier() + var lines =<< trim END + set hlsearch & hlsearch ! + call assert_equal(1, &hlsearch) + END + CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + set hlsearch & + END + CheckScriptFailure(lines, 'E518:') + + lines =<< trim END + vim9script + set hlsearch & hlsearch ! + END + CheckScriptFailure(lines, 'E518:') +enddef + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new diff --git a/src/version.c b/src/version.c index d1201f4f6..d217fe615 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3021, +/**/ 3020, /**/ 3019, |