File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,18 @@ local M = {
1414
1515--- @param windows integer[]
1616local function close_windows (windows )
17- -- Prevent from closing when the win count equals 1 or 2,
18- -- where the win to remove could be the last opened.
19- -- For details see #2503.
20- if view .View .float .enable and # vim .api .nvim_list_wins () < 3 then
21- return
17+ -- When floating, prevent closing the last non-floating window.
18+ -- For details see #2503, #3187.
19+ if view .View .float .enable then
20+ local non_float_count = 0
21+ for _ , win in ipairs (vim .api .nvim_list_wins ()) do
22+ if vim .api .nvim_win_get_config (win ).relative == " " then
23+ non_float_count = non_float_count + 1
24+ end
25+ end
26+ if non_float_count <= 1 then
27+ return
28+ end
2229 end
2330
2431 for _ , window in ipairs (windows ) do
You can’t perform that action at this time.
0 commit comments