From 1573aa0b0a0a17da93e4fb2220fd5d6ecbd6d267 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sat, 14 May 2016 12:26:03 +0200 Subject: vim-patch:7.4.1119 Problem: argidx() has a wrong value after ":%argdelete". (Yegappan Lakshmanan) Solution: Correct the value of w_arg_idx. Add a test. https://github.com/vim/vim/commit/72defda84eb26be9e2ade56c7877b912f818026e --- src/nvim/ex_cmds2.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 12efddc205..18e09a7619 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1861,11 +1861,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(); } -- cgit From dfdf7c02be1758f4adfe487a36f372f514dda39a Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sat, 14 May 2016 12:40:05 +0200 Subject: vim-patch:7.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. https://github.com/vim/vim/commit/a24f0a550fed3d9773800cf6be4efd072fff20ec --- src/nvim/ex_cmds2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 18e09a7619..b6d0ef78cf 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2098,6 +2098,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) @@ -2112,8 +2113,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; } } -- cgit From 055c9e1be6d73fa4a4f84299dbdbcaf8e2db140a Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sat, 14 May 2016 15:51:44 +0200 Subject: vim-patch:7.4.1161 Problem: ":argadd" without argument is supposed to add the current buffer name to the arglist. Solution: Make it work as documented. (Coot, closes vim/vim#577) https://github.com/vim/vim/commit/2faa29f896252073b53f387406109e331fbbe5f8 --- src/nvim/ex_cmds2.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index b6d0ef78cf..fd299eaa8a 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1487,9 +1487,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) { -- cgit