mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
vim-patch:8.0.1763: :argedit does not reuse an empty unnamed buffer
Problem: :argedit does not reuse an empty unnamed buffer.
Solution: Add the BLN_CURBUF flag and fix all the side effects. (Christian Brabandt)
46a53dfc29
This commit is contained in:
@@ -1952,14 +1952,17 @@ void ex_next(exarg_T *eap)
|
||||
void 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.
|
||||
bool curbuf_is_reusable = curbuf_reusable();
|
||||
|
||||
if (do_arglist(eap->arg, AL_ADD, i) == FAIL) {
|
||||
return;
|
||||
}
|
||||
maketitle();
|
||||
|
||||
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.
|
||||
@@ -2257,7 +2260,8 @@ static int alist_add_list(int count, char_u **files, int after)
|
||||
}
|
||||
for (int 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) {
|
||||
|
Reference in New Issue
Block a user