vim-patch:8.1.1611: bufadd() reuses existing buffer without a name

Problem:    Bufadd() reuses existing buffer without a name.
Solution:   When the name is empty always create a new buffer.
892ae723ab
This commit is contained in:
Shougo Matsushita
2019-07-06 17:10:12 +09:00
parent 3f6346b732
commit 5f7e0531c1
2 changed files with 17 additions and 1 deletions

View File

@@ -7292,7 +7292,9 @@ static buf_T *find_buffer(typval_T *avar)
// "bufadd(expr)" function
static void f_bufadd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
rettv->vval.v_number = buflist_add(tv_get_string(&argvars[0]), 0);
char_u *name = tv_get_string(&argvars[0]);
rettv->vval.v_number = buflist_add(*name == NUL ? NULL : name, 0);
}
/*