diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-02-27 19:34:56 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-02-27 19:34:56 +0100 |
commit | 8da9bbfd02957b79edd595c8c7397453012510b0 (patch) | |
tree | cd3bd68b6c30f3d3a778621d4880c1f4f4067e62 /src/buffer.c | |
parent | ba17ed6797421b377ec0cac7ec186d24bf5b3979 (diff) | |
download | vim-git-8da9bbfd02957b79edd595c8c7397453012510b0.tar.gz |
updated for version 7.4.645v7.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.
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index e4230fc42..edb38d61c 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1794,7 +1794,6 @@ buflist_new(ffname, sfname, lnum, flags) if (aborting()) /* autocmds may abort script processing */ return NULL; #endif - /* buf->b_nwindows = 0; why was this here? */ free_buffer_stuff(buf, FALSE); /* delete local variables et al. */ /* Init the options. */ @@ -1872,6 +1871,9 @@ buflist_new(ffname, sfname, lnum, flags) #ifdef FEAT_AUTOCMD 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; |