Skip to content

Commit f4a7799

Browse files
authored
fix: fix floating windows, which were broken in prior commit (#1012)
1 parent 915efc3 commit f4a7799

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lua/neo-tree/ui/renderer.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,8 @@ create_window = function(state)
959959

960960
local win
961961
if state.current_position == "float" then
962-
win = create_floating_window(state, win_options, bufname)
962+
M.close_all_floating_windows()
963+
win = create_floating_window(state, win_options, bufname)
963964
elseif state.current_position == "current" then
964965
-- state.id is always the window id or tabnr that this state was created for
965966
-- in the case of a position = current state object, it will be the window id
@@ -992,8 +993,6 @@ create_window = function(state)
992993
state.bufnr = win.bufnr
993994
state.winid = win.winid
994995
location.winid = state.winid
995-
vim.api.nvim_buf_set_name(state.bufnr, bufname)
996-
vim.api.nvim_set_current_win(state.winid)
997996
end
998997
location.source = state.name
999998
end
@@ -1009,6 +1008,8 @@ create_window = function(state)
10091008
end
10101009

10111010
if win ~= nil then
1011+
vim.api.nvim_buf_set_name(state.bufnr, bufname)
1012+
vim.api.nvim_set_current_win(state.winid)
10121013
-- Used to track the position of the cursor within the tree as it gains and loses focus
10131014
--
10141015
-- Note `WinEnter` is often too early to restore the cursor position so we do not set

0 commit comments

Comments
 (0)