diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-08-12 13:05:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-12 13:05:59 +0200 |
commit | ae24c9b27016a841121b1a01664b748b0a5cbeb7 (patch) | |
tree | 9c44b75a3cffe6bbf7bbd8261267ed60f1c6b997 /src/nvim/buffer.c | |
parent | 47f9ab46357e7f0cbd0c7f475ade01c2c26aac47 (diff) | |
parent | 3d77ca39c70446ed63a54ee286688c394826511c (diff) | |
download | rneovim-ae24c9b27016a841121b1a01664b748b0a5cbeb7.tar.gz rneovim-ae24c9b27016a841121b1a01664b748b0a5cbeb7.tar.bz2 rneovim-ae24c9b27016a841121b1a01664b748b0a5cbeb7.zip |
Merge #8847 from janlazo/vim-8.0.1037
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 71e04ec0fb..3fadcc75bf 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -505,14 +505,20 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) int nwindows = buf->b_nwindows; - /* decrease the link count from windows (unless not in any window) */ - if (buf->b_nwindows > 0) - --buf->b_nwindows; + // decrease the link count from windows (unless not in any window) + if (buf->b_nwindows > 0) { + buf->b_nwindows--; + } + + if (diffopt_hiddenoff() && !unload_buf && buf->b_nwindows == 0) { + diff_buf_delete(buf); // Clear 'diff' for hidden buffer. + } /* Return when a window is displaying the buffer or when it's not * unloaded. */ - if (buf->b_nwindows > 0 || !unload_buf) + if (buf->b_nwindows > 0 || !unload_buf) { return; + } if (buf->terminal) { terminal_close(buf->terminal, NULL); |