aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-23 18:05:31 +0800
committerGitHub <noreply@github.com>2022-03-23 18:05:31 +0800
commit0621cd31129d111282043e4543d2507013adb653 (patch)
tree7a26bb3c9d0cd42f772afd7e2d4ded677c49c01c /src/nvim/buffer.c
parent7735163652cd9082ef89cb31707ca77df12f7b70 (diff)
parenta9359dca3794754ac3d4caff1bb86fe5d4dad547 (diff)
downloadrneovim-0621cd31129d111282043e4543d2507013adb653.tar.gz
rneovim-0621cd31129d111282043e4543d2507013adb653.tar.bz2
rneovim-0621cd31129d111282043e4543d2507013adb653.zip
Merge pull request #17806 from zeertzjq/win-close-float-fix
Fix some bugs with closing window or buffer when there are floating windows
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 1293edb1da..1fe80dc24c 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1042,6 +1042,10 @@ static int empty_curbuf(int close_others, int forceit, int action)
set_bufref(&bufref, buf);
if (close_others) {
+ if (curwin->w_floating) {
+ // Last window must be non-floating.
+ curwin = firstwin;
+ }
// Close any other windows on this buffer, then make it empty.
close_windows(buf, true);
}
@@ -1224,11 +1228,12 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
}
// If the deleted buffer is the current one, close the current window
- // (unless it's the only window). Repeat this so long as we end up in
- // a window with this buffer.
+ // (unless it's the only non-floating window).
+ // When the autocommand window is involved win_close() may need to print an error message.
+ // Repeat this so long as we end up in a window with this buffer.
while (buf == curbuf
&& !(curwin->w_closing || curwin->w_buffer->b_locked > 0)
- && (!ONE_WINDOW || first_tabpage->tp_next != NULL)) {
+ && (lastwin == aucmd_win || !last_window(curwin))) {
if (win_close(curwin, false, false) == FAIL) {
break;
}