vim-patch:7.4.645

Problem:    When splitting the window in a BufAdd autocommand while still in
            the first, empty buffer the window count is wrong.
Solution:   Do not reset b_nwindows to zero and don't increment it.

8da9bbfd02
This commit is contained in:
Shougo Matsushita
2015-12-13 12:56:24 +09:00
parent f183cc14de
commit d1ec3f661a
3 changed files with 6 additions and 6 deletions

View File

@@ -1414,7 +1414,6 @@ buflist_new (
return NULL;
if (aborting()) /* autocmds may abort script processing */
return NULL;
/* buf->b_nwindows = 0; why was this here? */
free_buffer_stuff(buf, FALSE); /* delete local variables et al. */
/* Init the options. */
@@ -1475,6 +1474,9 @@ buflist_new (
fmarks_check_names(buf); /* check file marks for this file */
buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */
if (!(flags & BLN_DUMMY)) {
// Tricky: these autocommands may change the buffer list. They could also
// split the window with re-using the one empty buffer. This may result in
// unexpectedly losing the empty buffer.
apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, buf);
if (!buf_valid(buf)) {
return NULL;