]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.4.645 v7.4.645
authorBram Moolenaar <Bram@vim.org>
Fri, 27 Feb 2015 18:34:56 +0000 (19:34 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 27 Feb 2015 18:34:56 +0000 (19:34 +0100)
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.

src/buffer.c
src/ex_cmds.c
src/version.c

index e4230fc420517a7a942b6118881347c90cfadf39..edb38d61c5f6266c9e3e09767987e0143e3c8445 100644 (file)
@@ -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;
index 84928723ef50fd8aaf241c6238dd6822f1a8fdcb..314a466993ffdce480452605692f7bd2265aef29 100644 (file)
@@ -3375,7 +3375,6 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
        if (buf->b_ml.ml_mfp == NULL)           /* no memfile yet */
        {
            oldbuf = FALSE;
-           buf->b_nwindows = 0;
        }
        else                                    /* existing memfile */
        {
@@ -3408,7 +3407,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
         * Make the (new) buffer the one used by the current window.
         * If the old buffer becomes unused, free it if ECMD_HIDE is FALSE.
         * If the current buffer was empty and has no file name, curbuf
-        * is returned by buflist_new().
+        * is returned by buflist_new(), nothing to do here.
         */
        if (buf != curbuf)
        {
@@ -3515,8 +3514,6 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
            au_new_curbuf = NULL;
 #endif
        }
-       else
-           ++curbuf->b_nwindows;
 
        curwin->w_pcmark.lnum = 1;
        curwin->w_pcmark.col = 0;
index 38f3b785f9398b1455991c62f10ce6786b45c3c4..41926a43814aac073509833ce8b59ed9870d9119 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    645,
 /**/
     644,
 /**/