To: vim_dev@googlegroups.com Subject: Patch 8.2.3124 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3124 Problem: Vim9: no error for white space between option and "=9". Solution: Check for extraneous white space. (issue #8408) Files: src/option.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.3123/src/option.c 2021-07-08 16:40:01.073808495 +0200 --- src/option.c 2021-07-08 17:28:10.716949420 +0200 *************** *** 1358,1364 **** // remember character after option name afterchar = arg[len]; ! if (!in_vim9script()) // skip white space, allow ":set ai ?", ":set hlsearch !" while (VIM_ISWHITE(arg[len])) ++len; --- 1358,1379 ---- // remember character after option name afterchar = arg[len]; ! 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; *** ../vim-8.2.3123/src/testdir/test_vim9_script.vim 2021-07-08 16:40:01.073808495 +0200 --- src/testdir/test_vim9_script.vim 2021-07-08 17:24:42.709293816 +0200 *************** *** 4075,4080 **** --- 4075,4119 ---- delfunc g:FuncA enddef + def Test_option_set() + # legacy script allows for white space + var lines =<< trim END + set foldlevel =11 + call assert_equal(11, &foldlevel) + END + CheckScriptSuccess(lines) + + set foldlevel + set foldlevel=12 + assert_equal(12, &foldlevel) + set foldlevel+=2 + assert_equal(14, &foldlevel) + set foldlevel-=3 + assert_equal(11, &foldlevel) + + lines =<< trim END + set foldlevel =1 + END + CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: =1') + + lines =<< trim END + set foldlevel +=1 + END + CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: +=1') + + lines =<< trim END + set foldlevel ^=1 + END + CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: ^=1') + + lines =<< trim END + set foldlevel -=1 + END + CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between option and: -=1') + + set foldlevel& + enddef + def Test_option_modifier() # legacy script allows for white space var lines =<< trim END *** ../vim-8.2.3123/src/version.c 2021-07-08 16:40:01.077808506 +0200 --- src/version.c 2021-07-08 17:31:29.040673390 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3124, /**/ -- From "know your smileys": :-* A big kiss! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///