Problem: Spaces allowed between option name and "!", "?", etc.
Solution: Disallow spaces in Vim9 script, it was not documented.
(closes #8408)
// 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;
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
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 3021,
/**/
3020,
/**/