diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-01-16 00:59:50 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-01-16 00:59:50 +0100 |
commit | 3ba5e43d2e3baec1f7e74e2dce7ad340c47c26ad (patch) | |
tree | 8075781ad357cb05bf1bf8cf9541181589b32d7d /src/nvim/buffer.c | |
parent | 3fd7be6d3ed1b27b3c6f811d3f210cb9c30deaa4 (diff) | |
parent | 2b56cf099a8f383e74496ff48810c8029d3c1ba5 (diff) | |
download | rneovim-3ba5e43d2e3baec1f7e74e2dce7ad340c47c26ad.tar.gz rneovim-3ba5e43d2e3baec1f7e74e2dce7ad340c47c26ad.tar.bz2 rneovim-3ba5e43d2e3baec1f7e74e2dce7ad340c47c26ad.zip |
Merge #5918 'vim-patch: 7.4.2006, 7.4.2075, 7.4.2077, 7.4.2117, 7.4.2300, 7.4.2313, 7.4.2314'.
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 8909fdd57a..600cf575fc 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -409,9 +409,6 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) buf->b_nwindows = nwindows; buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); - if (win_valid_any_tab(win) && win->w_buffer == buf) { - win->w_buffer = NULL; // make sure we don't use the buffer now - } /* Autocommands may have deleted the buffer. */ if (!buf_valid(buf)) @@ -419,11 +416,6 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) if (aborting()) /* autocmds may abort script processing */ return; - /* Autocommands may have opened or closed windows for this buffer. - * Decrement the count for the close we do here. */ - if (buf->b_nwindows > 0) - --buf->b_nwindows; - /* * It's possible that autocommands change curbuf to the one being deleted. * This might cause the previous curbuf to be deleted unexpectedly. But @@ -434,6 +426,16 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) if (buf == curbuf && !is_curbuf) return; + if (win_valid_any_tab(win) && win->w_buffer == buf) { + win->w_buffer = NULL; // make sure we don't use the buffer now + } + + // Autocommands may have opened or closed windows for this buffer. + // Decrement the count for the close we do here. + if (buf->b_nwindows > 0) { + buf->b_nwindows--; + } + /* Change directories when the 'acd' option is set. */ do_autochdir(); |