Skip to content

Commit 76f7223

Browse files
committed
fix: ignore floating in win count for last window check, may fix #137
1 parent 04bb76d commit 76f7223

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lua/neo-tree.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,12 @@ M.win_enter_event = function()
406406
local tabnr = vim.api.nvim_get_current_tabpage()
407407
local wins = utils.get_value(M, "config.prior_windows", {})[tabnr]
408408
local prior_exists = utils.truthy(wins)
409-
local win_count = #vim.api.nvim_tabpage_list_wins(tabnr)
409+
local non_floating_wins = vim.tbl_filter(function(win)
410+
return not utils.is_floating(win)
411+
end, vim.api.nvim_tabpage_list_wins(tabnr))
412+
local win_count = #non_floating_wins
410413
log.trace("checking if last window")
411-
log.trace("prior window is ", prior_exists)
414+
log.trace("prior window exists = ", prior_exists)
412415
log.trace("win_count: ", win_count)
413416
if prior_exists and win_count == 1 and vim.o.filetype == "neo-tree" then
414417
local position = vim.api.nvim_buf_get_var(0, "neo_tree_position")

0 commit comments

Comments
 (0)