Patch 8.2.3123
Problem: Vim9: confusing error when using white space after option, before
one of "!&<".
Solution: Give a specific error. (issue #8408)
Files: src/errors.h, src/option.c, src/testdir/test_vim9_script.vim
*** ../vim-8.2.3122/src/errors.h 2021-07-05 20:14:54.396221575 +0200
--- src/errors.h 2021-07-08 16:39:15.777699981 +0200
***************
*** 490,492 ****
--- 490,494 ----
INIT(= N_("E1203: Dot can only be used on a dictionary: %s"));
EXTERN char e_regexp_number_after_dot_pos_search[]
INIT(= N_("E1204: No Number allowed after .: '\\%%%c'"));
+ EXTERN char e_no_white_space_allowed_between_option_and[]
+ INIT(= N_("E1205: No white space allowed between option and"));
*** ../vim-8.2.3122/src/option.c 2021-06-30 20:54:30.696546341 +0200
--- src/option.c 2021-07-08 16:39:24.849721426 +0200
***************
*** 1230,1238 ****
*/
int
do_set(
! char_u *arg, // option string (may be written to!)
int opt_flags)
{
int opt_idx;
char *errmsg;
char errbuf[80];
--- 1230,1239 ----
*/
int
do_set(
! char_u *arg_start, // option string (may be written to!)
int opt_flags)
{
+ char_u *arg = arg_start;
int opt_idx;
char *errmsg;
char errbuf[80];
***************
*** 1387,1393 ****
if (opt_idx == -1 && key == 0) // found a mismatch: skip
{
! errmsg = N_("E518: Unknown option");
goto skip;
}
--- 1388,1398 ----
if (opt_idx == -1 && key == 0) // found a mismatch: skip
{
! if (in_vim9script() && arg > arg_start
! && vim_strchr((char_u *)"!&<", *arg) != NULL)
! errmsg = e_no_white_space_allowed_between_option_and;
! else
! errmsg = N_("E518: Unknown option");
goto skip;
}
*** ../vim-8.2.3122/src/testdir/test_vim9_script.vim 2021-07-07
21:55:20.850427019 +0200
--- src/testdir/test_vim9_script.vim 2021-07-08 16:38:00.797529136 +0200
***************
*** 4076,4098 ****
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.
--- 4076,4107 ----
enddef
def Test_option_modifier()
+ # legacy script allows for white space
var lines =<< trim END
set hlsearch & hlsearch !
call assert_equal(1, &hlsearch)
END
CheckScriptSuccess(lines)
+ set hlsearch
+ set hlsearch!
+ assert_equal(false, &hlsearch)
+
+ set hlsearch
+ set hlsearch&
+ assert_equal(false, &hlsearch)
+
lines =<< trim END
set hlsearch &
END
! CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between
option and: &')
lines =<< trim END
! set hlsearch !
END
! CheckDefExecAndScriptFailure(lines, 'E1205: No white space allowed between
option and: !')
!
! set hlsearch&
enddef
" Keep this last, it messes up highlighting.
*** ../vim-8.2.3122/src/version.c 2021-07-08 13:19:09.013465756 +0200
--- src/version.c 2021-07-08 15:05:13.190845644 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3123,
/**/
--
Common sense is what tells you that the world is flat.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202107081440.168EehE9030560%40masaka.moolenaar.net.