From 2083c1771ad2de44c8e085062a0777e694b0fd4d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Sep 2022 20:25:34 +0800 Subject: fix(window): close floats first when closing buffer in other tab (#20284) --- src/nvim/window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit