Merge pull request #3288 from oni-link/vim-7.4.602

vim-patch:7.4.602 #3288
    
Problem:    ":set" does not accept hex numbers as documented.
Solution:   Use vim_str2nr(). (ZyX)
    
18400e6430
This commit is contained in:
oni-link 2015-09-06 08:11:29 +02:00
commit f39ac69824
3 changed files with 6 additions and 15 deletions

View File

@ -58,9 +58,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>). See |cmdline-completion|. default this is a <Tab>). See |cmdline-completion|.
White space between {option} and '=' is allowed and White space between {option} and '=' is allowed and

View File

@ -1214,17 +1214,10 @@ do_set (
errmsg = e_invarg; errmsg = e_invarg;
goto skip; goto skip;
} }
} } else if (*arg == '-' || ascii_isdigit(*arg)) {
/* allow negative numbers (for 'undolevels') */ // Allow negative (for 'undolevels'), octal and
else if (*arg == '-' || ascii_isdigit(*arg)) { // hex numbers.
i = 0; vim_str2nr(arg, NULL, &i, true, true, &value, NULL);
if (*arg == '-')
i = 1;
value = strtol((char *)arg, NULL, 0);
if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
i += 2;
while (ascii_isdigit(arg[i]))
++i;
if (arg[i] != NUL && !ascii_iswhite(arg[i])) { if (arg[i] != NUL && !ascii_iswhite(arg[i])) {
errmsg = e_invarg; errmsg = e_invarg;
goto skip; goto skip;

View File

@ -319,7 +319,7 @@ static int included_patches[] = {
// 605, // 605,
// 604, // 604,
// 603, // 603,
// 602, 602,
601, 601,
600, 600,
599, 599,