summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-17 19:39:00 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-17 19:39:00 +0100
commita24f0a550fed3d9773800cf6be4efd072fff20ec (patch)
treeac78f6a57af6cbd09d96a2b2f1c2e6b81ac2125f /src/ex_cmds2.c
parent42c9cfa7f4d2f176234e385573ff2fb1f61915e5 (diff)
patch 7.4.1123v7.4.1123
Problem: Using ":argadd" when there are no arguments results in the second argument to be the current one. (Yegappan Lakshmanan) Solution: Correct the w_arg_idx value.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 012a1af222..59bf945894 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2836,6 +2836,7 @@ alist_add_list(count, files, after)
int after; /* where to add: 0 = before first one */
{
int i;
+ int old_argcount = ARGCOUNT;
if (ga_grow(&ALIST(curwin)->al_ga, count) == OK)
{
@@ -2852,8 +2853,8 @@ alist_add_list(count, files, after)
ARGLIST[after + i].ae_fnum = buflist_add(files[i], BLN_LISTED);
}
ALIST(curwin)->al_ga.ga_len += count;
- if (curwin->w_arg_idx >= after)
- ++curwin->w_arg_idx;
+ if (old_argcount > 0 && curwin->w_arg_idx >= after)
+ curwin->w_arg_idx += count;
return after;
}