mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 06:48:17 +00:00
api: add nvim_create_buf to create a new empty buffer.
Loading existing files into a buffer is non-trivial and requires a window. Creating an unnamed emtpy buffer is trivial and safe though, thus worth a special case. Change nvim_buf_set_option to use aucmd_prepbuf. This is necessary to allow some options to be set on a not yet displayed buffer, such as 'buftype' option. vim-patch:7.4.1858: Add BLN_NEW to enforce buflist_new creating new buffer
This commit is contained in:
@@ -1629,7 +1629,7 @@ buf_T * buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags)
|
||||
FileID file_id;
|
||||
bool file_id_valid = (sfname != NULL
|
||||
&& os_fileid((char *)sfname, &file_id));
|
||||
if (ffname != NULL && !(flags & BLN_DUMMY)
|
||||
if (ffname != NULL && !(flags & (BLN_DUMMY | BLN_NEW))
|
||||
&& (buf = buflist_findname_file_id(ffname, &file_id,
|
||||
file_id_valid)) != NULL) {
|
||||
xfree(ffname);
|
||||
|
Reference in New Issue
Block a user