summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-08 17:35:36 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-08 17:35:36 +0200
commitdeb108ba0a8599c1307ddc1507c73e7b60f17d36 (patch)
treecc03cfd7309a8c46f0e7d26d49ca19ea2f5ea628 /src/option.c
parent1594f313452cf6ca88375d9c8f68605a9c3c8ab5 (diff)
downloadvim-git-deb108ba0a8599c1307ddc1507c73e7b60f17d36.tar.gz
patch 8.2.3124: Vim9: no error for white space between option and "=9"v8.2.3124
Problem: Vim9: no error for white space between option and "=9". Solution: Check for extraneous white space. (issue #8408)
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/option.c b/src/option.c
index 90e3e6d53..6232cd96d 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1358,7 +1358,22 @@ do_set(
// remember character after option name
afterchar = arg[len];
- if (!in_vim9script())
+ if (in_vim9script())
+ {
+ char_u *p = skipwhite(arg + len);
+
+ // disallow white space before =val, +=val, -=val, ^=val
+ if (p > arg + len && (p[0] == '='
+ || (vim_strchr((char_u *)"+-^", p[0]) != NULL
+ && p[1] == '=')))
+ {
+ errmsg = e_no_white_space_allowed_between_option_and;
+ arg = p;
+ startarg = p;
+ goto skip;
+ }
+ }
+ else
// skip white space, allow ":set ai ?", ":set hlsearch !"
while (VIM_ISWHITE(arg[len]))
++len;