aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-23 14:42:59 +0800
committerGitHub <noreply@github.com>2023-09-23 14:42:59 +0800
commitc0a29931e29bbb40650df01918826cdb64e8fc32 (patch)
tree83ba5c84c404f0e6dc7673a0f085a24cab9732e1 /src/nvim/buffer.c
parentc88bb658ce6fb12cca3e5324d8a15d1859d095cd (diff)
downloadrneovim-c0a29931e29bbb40650df01918826cdb64e8fc32.tar.gz
rneovim-c0a29931e29bbb40650df01918826cdb64e8fc32.tar.bz2
rneovim-c0a29931e29bbb40650df01918826cdb64e8fc32.zip
fix(unhide): close floating windows first (#25318)
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 0564b4305b..f2174e055b 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3616,8 +3616,11 @@ void ex_buffer_all(exarg_T *eap)
}
while (true) {
tpnext = curtab->tp_next;
- for (wp = firstwin; wp != NULL; wp = wpnext) {
- wpnext = wp->w_next;
+ // Try to close floating windows first
+ for (wp = lastwin->w_floating ? lastwin : firstwin; wp != NULL; wp = wpnext) {
+ wpnext = wp->w_floating
+ ? wp->w_prev->w_floating ? wp->w_prev : firstwin
+ : (wp->w_next == NULL || wp->w_next->w_floating) ? NULL : wp->w_next;
if ((wp->w_buffer->b_nwindows > 1
|| ((cmdmod.cmod_split & WSP_VERT)
? wp->w_height + wp->w_hsep_height + wp->w_status_height < Rows - p_ch
@@ -3632,7 +3635,7 @@ void ex_buffer_all(exarg_T *eap)
}
// Just in case an autocommand does something strange with
// windows: start all over...
- wpnext = firstwin;
+ wpnext = lastwin->w_floating ? lastwin : firstwin;
tpnext = first_tabpage;
open_wins = 0;
} else {