mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3123: Vim9: confusing error when using white space after option
Problem: Vim9: confusing error when using white space after option, before one of "!&<". Solution: Give a specific error. (issue #8408)
This commit is contained in:
parent
30441bb3d5
commit
1594f31345
@ -490,3 +490,5 @@ EXTERN char e_dot_can_only_be_used_on_dictionary_str[]
|
|||||||
INIT(= N_("E1203: Dot can only be used on a dictionary: %s"));
|
INIT(= N_("E1203: Dot can only be used on a dictionary: %s"));
|
||||||
EXTERN char e_regexp_number_after_dot_pos_search[]
|
EXTERN char e_regexp_number_after_dot_pos_search[]
|
||||||
INIT(= N_("E1204: No Number allowed after .: '\\%%%c'"));
|
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"));
|
||||||
|
@ -1230,9 +1230,10 @@ ex_set(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
do_set(
|
do_set(
|
||||||
char_u *arg, // option string (may be written to!)
|
char_u *arg_start, // option string (may be written to!)
|
||||||
int opt_flags)
|
int opt_flags)
|
||||||
{
|
{
|
||||||
|
char_u *arg = arg_start;
|
||||||
int opt_idx;
|
int opt_idx;
|
||||||
char *errmsg;
|
char *errmsg;
|
||||||
char errbuf[80];
|
char errbuf[80];
|
||||||
@ -1387,6 +1388,10 @@ do_set(
|
|||||||
|
|
||||||
if (opt_idx == -1 && key == 0) // found a mismatch: skip
|
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");
|
errmsg = N_("E518: Unknown option");
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
@ -4076,23 +4076,32 @@ def Test_mapping_line_number()
|
|||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_option_modifier()
|
def Test_option_modifier()
|
||||||
|
# legacy script allows for white space
|
||||||
var lines =<< trim END
|
var lines =<< trim END
|
||||||
set hlsearch & hlsearch !
|
set hlsearch & hlsearch !
|
||||||
call assert_equal(1, &hlsearch)
|
call assert_equal(1, &hlsearch)
|
||||||
END
|
END
|
||||||
CheckScriptSuccess(lines)
|
CheckScriptSuccess(lines)
|
||||||
|
|
||||||
lines =<< trim END
|
set hlsearch
|
||||||
vim9script
|
set hlsearch!
|
||||||
|
assert_equal(false, &hlsearch)
|
||||||
|
|
||||||
|
set hlsearch
|
||||||
set hlsearch&
|
set hlsearch&
|
||||||
END
|
assert_equal(false, &hlsearch)
|
||||||
CheckScriptFailure(lines, 'E518:')
|
|
||||||
|
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
vim9script
|
set hlsearch &
|
||||||
set hlsearch & hlsearch !
|
|
||||||
END
|
END
|
||||||
CheckScriptFailure(lines, 'E518:')
|
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
|
enddef
|
||||||
|
|
||||||
" Keep this last, it messes up highlighting.
|
" Keep this last, it messes up highlighting.
|
||||||
|
@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3123,
|
||||||
/**/
|
/**/
|
||||||
3122,
|
3122,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user