From 208f0b48b2c616b29f377a1408290111ed2663f7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 20 Jun 2021 12:40:08 +0200 Subject: patch 8.2.3021: spaces allowed between option name and "!", "?", etc. Problem: Spaces allowed between option name and "!", "?", etc. Solution: Disallow spaces in Vim9 script, it was not documented. (closes #8408) --- src/option.c | 7 ++++--- src/testdir/test_vim9_script.vim | 20 ++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 26 insertions(+), 3 deletions(-) (limited to 'src') 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 @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3021, /**/ 3020, /**/ -- cgit v1.2.1