Patch 8.1.1611
Problem: Bufadd() reuses existing buffer without a name.
Solution: When the name is empty always create a new buffer.
Files: src/evalfunc.c, src/testdir/test_functions.vim
*** ../vim-8.1.1610/src/evalfunc.c 2019-06-30 20:21:30.456516156 +0200
--- src/evalfunc.c 2019-06-30 20:31:23.772613497 +0200
***************
*** 1929,1935 ****
static void
f_bufadd(typval_T *argvars, typval_T *rettv)
{
! rettv->vval.v_number = buflist_add(tv_get_string(&argvars[0]), 0);
}
/*
--- 1929,1937 ----
static void
f_bufadd(typval_T *argvars, typval_T *rettv)
{
! char_u *name = tv_get_string(&argvars[0]);
!
! rettv->vval.v_number = buflist_add(*name == NUL ? NULL : name, 0);
}
/*
*** ../vim-8.1.1610/src/testdir/test_functions.vim 2019-06-30 20:21:30.456516156 +0200
--- src/testdir/test_functions.vim 2019-06-30 20:26:50.262396146 +0200
***************
*** 1539,1544 ****
--- 1539,1558 ----
call assert_equal(['some', 'text'], getbufline(buf, 1, '$'))
call assert_equal(curbuf, bufnr(''))
+ let buf1 = bufadd('')
+ let buf2 = bufadd('')
+ call assert_notequal(0, buf1)
+ call assert_notequal(0, buf2)
+ call assert_notequal(buf1, buf2)
+ call assert_equal(1, bufexists(buf1))
+ call assert_equal(1, bufexists(buf2))
+ call assert_equal(0, bufloaded(buf1))
+ exe 'bwipe ' .. buf1
+ call assert_equal(0, bufexists(buf1))
+ call assert_equal(1, bufexists(buf2))
+ exe 'bwipe ' .. buf2
+ call assert_equal(0, bufexists(buf2))
+
bwipe someName
bwipe otherName
call assert_equal(0, bufexists('someName'))
*** ../vim-8.1.1610/src/version.c 2019-06-30 20:21:30.460516130 +0200
--- src/version.c 2019-06-30 20:32:29.560187393 +0200
***************
*** 779,780 ****
--- 779,782 ----
{ /* Add new patch number below this line */
+ /**/
+ 1611,
/**/
--
DINGO: Wicked wicked Zoot ... she is a bad person and she must pay the
penalty. And here in Castle Anthrax, we have but one punishment
... you must tie her down on a bed ... and spank her. Come!
GIRLS: A spanking! A spanking!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///