From 90b2da16ae1aadc070183a0eeb237dddd0cd21b8 Mon Sep 17 00:00:00 2001 From: notomo Date: Mon, 23 Aug 2021 07:27:20 +0900 Subject: fix(window.c): win_close from other tabpage #15454 Fix #15313 --- src/nvim/window.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/nvim/window.c') diff --git a/src/nvim/window.c b/src/nvim/window.c index f0faeac2d7..eddbe14da2 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2709,7 +2709,11 @@ static win_T *win_free_mem( // When deleting the current window of another tab page select a new // current window. if (tp != NULL && win == tp->tp_curwin) { - tp->tp_curwin = wp; + if (win_valid(tp->tp_prevwin) && tp->tp_prevwin != win) { + tp->tp_curwin = tp->tp_prevwin; + } else { + tp->tp_curwin = tp->tp_firstwin; + } } return wp; -- cgit