summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-11-02 15:44:14 +0100
committerBram Moolenaar <Bram@vim.org>2017-11-02 15:44:14 +0100
commitffd99f729bd806e09d9355ede9c17780b61057bf (patch)
treeda7d97abd95882da43082199094045864b49e26e /src/eval.c
parent89c394faca40d2f5d57705432a433173b295bf73 (diff)
patch 8.0.1242: function argument with only dash is seen as number zerov8.0.1242
Problem: Function argument with only dash is seen as number zero. (Wang Shidong) Solution: See a dash as a string. (Christian Brabandt)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c
index e8a1b0aa35..b3e2be5d0e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1056,8 +1056,13 @@ call_vim_function(
if (str_arg_only)
len = 0;
else
- /* Recognize a number argument, the others must be strings. */
+ {
+ /* Recognize a number argument, the others must be strings. A dash
+ * is a string too. */
vim_str2nr(argv[i], NULL, &len, STR2NR_ALL, &n, NULL, 0);
+ if (len == 1 && *argv[i] == '-')
+ len = 0;
+ }
if (len != 0 && len == (int)STRLEN(argv[i]))
{
argvars[i].v_type = VAR_NUMBER;