Mercurial > vim
diff src/evalfunc.c @ 17223:07bbe73b8e74 v8.1.1611
patch 8.1.1611: bufadd() reuses existing buffer without a name
commit https://github.com/vim/vim/commit/892ae723ab95e429222e930cf41b32809567e58e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 30 20:33:01 2019 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 30 Jun 2019 20:45:05 +0200 |
parents | a8fc7d97b54d |
children | 09fa437d33d8 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1929,7 +1929,9 @@ find_buffer(typval_T *avar) static void f_bufadd(typval_T *argvars, typval_T *rettv) { - 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); } /*