aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/window.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index cc20a5fcec..236663dfea 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -2464,7 +2464,8 @@ void close_windows(buf_T *buf, bool keep_curwin)
for (tp = first_tabpage; tp != NULL; tp = nexttp) {
nexttp = tp->tp_next;
if (tp != curtab) {
- FOR_ALL_WINDOWS_IN_TAB(wp, tp) {
+ // Start from tp_lastwin to close floating windows with the same buffer first.
+ for (win_T *wp = tp->tp_lastwin; wp != NULL; wp = wp->w_prev) {
if (wp->w_buffer == buf
&& !(wp->w_closing || wp->w_buffer->b_locked > 0)) {
win_close_othertab(wp, false, tp);