updated for version 7.4.602
Problem: ":set" does not accept hex numbers as documented. Solution: Use vim_str2nr(). (ZyX)
This commit is contained in:
@ -59,9 +59,7 @@ achieve special effects. These options come in three forms:
|
|||||||
:se[t] {option}:{value}
|
:se[t] {option}:{value}
|
||||||
Set string or number option to {value}.
|
Set string or number option to {value}.
|
||||||
For numeric options the value can be given in decimal,
|
For numeric options the value can be given in decimal,
|
||||||
hex (preceded with 0x) or octal (preceded with '0')
|
hex (preceded with 0x) or octal (preceded with '0').
|
||||||
(hex and octal are only available for machines which
|
|
||||||
have the strtol() function).
|
|
||||||
The old value can be inserted by typing 'wildchar' (by
|
The old value can be inserted by typing 'wildchar' (by
|
||||||
default this is a <Tab> or CTRL-E if 'compatible' is
|
default this is a <Tab> or CTRL-E if 'compatible' is
|
||||||
set). See |cmdline-completion|.
|
set). See |cmdline-completion|.
|
||||||
|
|||||||
16
src/option.c
16
src/option.c
@ -4540,21 +4540,11 @@ do_set(arg, opt_flags)
|
|||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* allow negative numbers (for 'undolevels') */
|
|
||||||
else if (*arg == '-' || VIM_ISDIGIT(*arg))
|
else if (*arg == '-' || VIM_ISDIGIT(*arg))
|
||||||
{
|
{
|
||||||
i = 0;
|
/* Allow negative (for 'undolevels'), octal and
|
||||||
if (*arg == '-')
|
* hex numbers. */
|
||||||
i = 1;
|
vim_str2nr(arg, NULL, &i, TRUE, TRUE, &value, NULL);
|
||||||
#ifdef HAVE_STRTOL
|
|
||||||
value = strtol((char *)arg, NULL, 0);
|
|
||||||
if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
|
|
||||||
i += 2;
|
|
||||||
#else
|
|
||||||
value = atol((char *)arg);
|
|
||||||
#endif
|
|
||||||
while (VIM_ISDIGIT(arg[i]))
|
|
||||||
++i;
|
|
||||||
if (arg[i] != NUL && !vim_iswhite(arg[i]))
|
if (arg[i] != NUL && !vim_iswhite(arg[i]))
|
||||||
{
|
{
|
||||||
errmsg = e_invarg;
|
errmsg = e_invarg;
|
||||||
|
|||||||
@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
602,
|
||||||
/**/
|
/**/
|
||||||
601,
|
601,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user