Skip to content

Commit 2145bb5

Browse files
brammooldouglaskayama
authored andcommitted
updated for version 7.4.602
Problem: ":set" does not accept hex numbers as documented. Solution: Use vim_str2nr(). (ZyX)
1 parent ef3b4cb commit 2145bb5

3 files changed

Lines changed: 6 additions & 16 deletions

File tree

runtime/doc/options.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ achieve special effects. These options come in three forms:
5959
:se[t] {option}:{value}
6060
Set string or number option to {value}.
6161
For numeric options the value can be given in decimal,
62-
hex (preceded with 0x) or octal (preceded with '0')
63-
(hex and octal are only available for machines which
64-
have the strtol() function).
62+
hex (preceded with 0x) or octal (preceded with '0').
6563
The old value can be inserted by typing 'wildchar' (by
6664
default this is a <Tab> or CTRL-E if 'compatible' is
6765
set). See |cmdline-completion|.

src/option.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4540,21 +4540,11 @@ do_set(arg, opt_flags)
45404540
goto skip;
45414541
}
45424542
}
4543-
/* allow negative numbers (for 'undolevels') */
45444543
else if (*arg == '-' || VIM_ISDIGIT(*arg))
45454544
{
4546-
i = 0;
4547-
if (*arg == '-')
4548-
i = 1;
4549-
#ifdef HAVE_STRTOL
4550-
value = strtol((char *)arg, NULL, 0);
4551-
if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
4552-
i += 2;
4553-
#else
4554-
value = atol((char *)arg);
4555-
#endif
4556-
while (VIM_ISDIGIT(arg[i]))
4557-
++i;
4545+
/* Allow negative (for 'undolevels'), octal and
4546+
* hex numbers. */
4547+
vim_str2nr(arg, NULL, &i, TRUE, TRUE, &value, NULL);
45584548
if (arg[i] != NUL && !vim_iswhite(arg[i]))
45594549
{
45604550
errmsg = e_invarg;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
602,
744746
/**/
745747
601,
746748
/**/

0 commit comments

Comments
 (0)