aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds2.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-05-29 00:03:54 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-05-29 00:03:54 -0400
commit1e70ebe849e3e2a0bf9605485d5ef8c6b86b0e52 (patch)
tree2299628838916d666be9cc6c8966a42c61b960cb /src/nvim/ex_cmds2.c
parent5fed9f5626103eca5a0fe6d920c2e78456830a51 (diff)
parent36a57a9e8a311451cd40b7f8b2394fae6a67726f (diff)
downloadrneovim-1e70ebe849e3e2a0bf9605485d5ef8c6b86b0e52.tar.gz
rneovim-1e70ebe849e3e2a0bf9605485d5ef8c6b86b0e52.tar.bz2
rneovim-1e70ebe849e3e2a0bf9605485d5ef8c6b86b0e52.zip
Merge pull request #4756 from jbradaric/vim-7.4.1119
vim-patch:7.4.1119,7.4.1123,7.4.1132,7.4.1161
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r--src/nvim/ex_cmds2.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index d167c28182..df4a6d52c4 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1616,9 +1616,15 @@ do_arglist (
char_u *p;
int match;
- /*
- * Collect all file name arguments in "new_ga".
- */
+ // Set default argument for ":argadd" command.
+ if (what == AL_ADD && *str == NUL) {
+ if (curbuf->b_ffname == NULL) {
+ return FAIL;
+ }
+ str = curbuf->b_fname;
+ }
+
+ // Collect all file name arguments in "new_ga".
get_arglist(&new_ga, str);
if (what == AL_DEL) {
@@ -1990,11 +1996,17 @@ void ex_argdelete(exarg_T *eap)
} else if (curwin->w_arg_idx > eap->line1) {
curwin->w_arg_idx = (int)eap->line1;
}
+ if (ARGCOUNT == 0) {
+ curwin->w_arg_idx = 0;
+ } else if (curwin->w_arg_idx >= ARGCOUNT) {
+ curwin->w_arg_idx = ARGCOUNT - 1;
+ }
}
- } else if (*eap->arg == NUL)
+ } else if (*eap->arg == NUL) {
EMSG(_(e_argreq));
- else
+ } else {
do_arglist(eap->arg, AL_DEL, 0);
+ }
maketitle();
}
@@ -2221,6 +2233,7 @@ alist_add_list (
int after /* where to add: 0 = before first one */
)
{
+ int old_argcount = ARGCOUNT;
ga_grow(&ALIST(curwin)->al_ga, count);
{
if (after < 0)
@@ -2235,8 +2248,9 @@ alist_add_list (
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;
}
}