File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
Expand file tree Collapse file tree 2 files changed +15
-8
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
Original file line number Diff line number Diff line change @@ -319,9 +319,9 @@ local function grow()
319319 end
320320
321321 local final_width = M .View .initial_width
322- local max_width = math.huge
323- if M . View . max_width ~ = - 1 then
324- max_width = get_width ( M . View . max_width )
322+ local max_width = get_width ( M . View . max_width )
323+ if max_width = = - 1 then
324+ max_width = math.huge
325325 end
326326
327327 local ns_id = vim .api .nvim_get_namespaces ()[" NvimTreeExtmarks" ]
You can’t perform that action at this time.
0 commit comments