summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-07-16 15:31:17 +0200
committerBram Moolenaar <Bram@vim.org>2017-07-16 15:31:17 +0200
commit90305c66a8637ea43a6509c7ab597734dd218365 (patch)
tree355ef583c5c9f79a4f5849c087ba270728e402bf /src/ex_cmds2.c
parent6a77d2667e982655f6adacee774ee7aa2581bd8a (diff)
patch 8.0.0721: :argedit can only have one argumentv8.0.0721
Problem: :argedit can only have one argument. Solution: Allow for multiple arguments. (Christian Brabandt)
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 5f19592340..687bbaecfb 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2801,34 +2801,20 @@ ex_next(exarg_T *eap)
void
ex_argedit(exarg_T *eap)
{
- int fnum;
- int i;
- char_u *s;
-
- /* Add the argument to the buffer list and get the buffer number. */
- fnum = buflist_add(eap->arg, BLN_LISTED);
+ int i = eap->addr_count ? (int)eap->line2 : curwin->w_arg_idx + 1;
- /* Check if this argument is already in the argument list. */
- for (i = 0; i < ARGCOUNT; ++i)
- if (ARGLIST[i].ae_fnum == fnum)
- break;
- if (i == ARGCOUNT)
- {
- /* Can't find it, add it to the argument list. */
- s = vim_strsave(eap->arg);
- if (s == NULL)
- return;
- i = alist_add_list(1, &s,
- eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1);
- if (i < 0)
- return;
- curwin->w_arg_idx = i;
- }
-
- alist_check_arg_idx();
+ if (do_arglist(eap->arg, AL_ADD, i) == FAIL)
+ return;
+#ifdef FEAT_TITLE
+ maketitle();
+#endif
+ if (curwin->w_arg_idx == 0 && (curbuf->b_ml.ml_flags & ML_EMPTY)
+ && curbuf->b_ffname == NULL)
+ i = 0;
/* Edit the argument. */
- do_argfile(eap, i);
+ if (i < ARGCOUNT)
+ do_argfile(eap, i);
}
/*