Ben Schmidt wrote:
> Another oddity I've recently discovered is that str2nr won't accept an
> explicitly positive number, such as '+3'.
>
> This is unexpected. Would you be willing to adjust the behaviour? I
> can't think of any negative/compatibility-breaking side effects this
> would have, but I also don't know where the vim_str2nr function is used.
>
> The attached patch does the job.
vim_str2nr() is used in many places, I can't quickly see the impact of
this change. What user facing issue are you trying to solve? If it's
about str2nr() itself then it's better solved in f_str2nr().
*** eval.c~ Mon Jun 23 20:25:08 2008
--- eval.c Mon Jun 23 21:31:49 2008
***************
*** 16165,16170 ****
--- 16165,16172 ----
}
p = skipwhite(get_tv_string(&argvars[0]));
+ if (*p == '+')
+ p = skipwhite(p + 1);
vim_str2nr(p, NULL, NULL, base == 8 ? 2 : 0, base == 16 ? 2 : 0, &n,
NULL);
rettv->vval.v_number = n;
}
--
If your nose runs, and your feet smell, you might be upside down.
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---