Skip to content

Commit fee76c0

Browse files
authored
fix: always display in the original requested window when position=current (#814)
1 parent 205184a commit fee76c0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/neo-tree/ui/renderer.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,13 @@ create_window = function(state)
881881
-- why is this necessary?
882882
vim.api.nvim_set_current_win(win.winid)
883883
elseif state.current_position == "current" then
884-
local winid = vim.api.nvim_get_current_win()
884+
-- state.id is always the window id or tabnr that this state was created for
885+
-- in the case of a position = current state object, it will be the window id
886+
local winid = state.id
887+
if not vim.api.nvim_win_is_valid(winid) then
888+
log.warn("Window ", winid, " is no longer valid!")
889+
return
890+
end
885891
local bufnr = vim.fn.bufnr(bufname)
886892
if bufnr < 1 then
887893
bufnr = vim.api.nvim_create_buf(false, false)

0 commit comments

Comments
 (0)