Mercurial > vim
comparison src/buffer.c @ 6639:342568f82d82 v7.4.645
updated for version 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.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 27 Feb 2015 19:34:56 +0100 |
parents | c1ed973fb58f |
children | 97cc4ee3e095 |
comparison
equal
deleted
inserted
replaced
6638:c0d3287d5e89 | 6639:342568f82d82 |
---|---|
1792 return NULL; | 1792 return NULL; |
1793 #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) | 1793 #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) |
1794 if (aborting()) /* autocmds may abort script processing */ | 1794 if (aborting()) /* autocmds may abort script processing */ |
1795 return NULL; | 1795 return NULL; |
1796 #endif | 1796 #endif |
1797 /* buf->b_nwindows = 0; why was this here? */ | |
1798 free_buffer_stuff(buf, FALSE); /* delete local variables et al. */ | 1797 free_buffer_stuff(buf, FALSE); /* delete local variables et al. */ |
1799 | 1798 |
1800 /* Init the options. */ | 1799 /* Init the options. */ |
1801 buf->b_p_initialized = FALSE; | 1800 buf->b_p_initialized = FALSE; |
1802 buf_copy_options(buf, BCO_ENTER); | 1801 buf_copy_options(buf, BCO_ENTER); |
1870 fmarks_check_names(buf); /* check file marks for this file */ | 1869 fmarks_check_names(buf); /* check file marks for this file */ |
1871 buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */ | 1870 buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */ |
1872 #ifdef FEAT_AUTOCMD | 1871 #ifdef FEAT_AUTOCMD |
1873 if (!(flags & BLN_DUMMY)) | 1872 if (!(flags & BLN_DUMMY)) |
1874 { | 1873 { |
1874 /* Tricky: these autocommands may change the buffer list. They could | |
1875 * also split the window with re-using the one empty buffer. This may | |
1876 * result in unexpectedly losing the empty buffer. */ | |
1875 apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, buf); | 1877 apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, buf); |
1876 if (!buf_valid(buf)) | 1878 if (!buf_valid(buf)) |
1877 return NULL; | 1879 return NULL; |
1878 if (flags & BLN_LISTED) | 1880 if (flags & BLN_LISTED) |
1879 { | 1881 { |