From 0371d0f7afa5e01dd2ac8bbd3abcf0f7454872b3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 23 Jan 2023 18:55:11 +0800 Subject: refactor(win_close): remove "force", don't pass on "free_buf" (#21921) Problem: The "force" flag of win_close() complicates the code and adds edge cases where it is not clear what the correct behavior should be. The "free_buf" flag of win_close() is passed on to float windows when closing the last window of a tabpage, which doesn't make much sense. Solution: Remove the "force" flag and always close float windows as if :close! is used when closing the last window of a tabpage, and set the "free_buf" flag for a float window based on whether its buffer can be freed. As 'hidden' is on by default, this change shouldn't affect many people. --- src/nvim/api/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/api') diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index df8ad165ba..76ea4b6d7f 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -370,7 +370,7 @@ void nvim_win_hide(Window window, Error *err) TryState tstate; try_enter(&tstate); if (tabpage == curtab) { - win_close(win, false, false); + win_close(win, false); } else { win_close_othertab(win, false, tabpage); } -- cgit