summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-24 21:58:51 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-24 21:58:51 +0200
commit46a53dfc29689c6a0d80e3820e8b0a48dba6b6ec (patch)
tree5ad1a9ee29f54608ea20a0a77581bf21f760d770 /src/ex_cmds2.c
parentb255b90503a986931904c23dafb5b6d4e512a17e (diff)
patch 8.0.1763: :argedit does not reuse an empty unnamed bufferv8.0.1763
Problem: :argedit does not reuse an empty unnamed buffer. Solution: Add the BLN_CURBUF flag and fix all the side effects. (Christian Brabandt, closes #2713)
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 3e369a8a4f..69283d693c 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2941,6 +2941,8 @@ ex_next(exarg_T *eap)
ex_argedit(exarg_T *eap)
{
int i = eap->addr_count ? (int)eap->line2 : curwin->w_arg_idx + 1;
+ // Whether curbuf will be reused, curbuf->b_ffname will be set.
+ int curbuf_is_reusable = curbuf_reusable();
if (do_arglist(eap->arg, AL_ADD, i) == FAIL)
return;
@@ -2948,8 +2950,9 @@ ex_argedit(exarg_T *eap)
maketitle();
#endif
- if (curwin->w_arg_idx == 0 && (curbuf->b_ml.ml_flags & ML_EMPTY)
- && curbuf->b_ffname == NULL)
+ if (curwin->w_arg_idx == 0
+ && (curbuf->b_ml.ml_flags & ML_EMPTY)
+ && (curbuf->b_ffname == NULL || curbuf_is_reusable))
i = 0;
/* Edit the argument. */
if (i < ARGCOUNT)
@@ -3281,7 +3284,8 @@ alist_add_list(
for (i = 0; i < count; ++i)
{
ARGLIST[after + i].ae_fname = files[i];
- ARGLIST[after + i].ae_fnum = buflist_add(files[i], BLN_LISTED);
+ ARGLIST[after + i].ae_fnum =
+ buflist_add(files[i], BLN_LISTED | BLN_CURBUF);
}
ALIST(curwin)->al_ga.ga_len += count;
if (old_argcount > 0 && curwin->w_arg_idx >= after)