Skip to content

Commit 80f734f

Browse files
committed
fix: fix restore position bug caused by fb014a
1 parent 99d8c11 commit 80f734f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lua/neo-tree/command/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ M.execute = function(args)
9191
local current_position = state.current_position or default_position
9292
local position_changed = false
9393
if args.position then
94-
state.position = args.position
94+
state.current_position = args.position
9595
position_changed = args.position ~= current_position
9696
end
9797

lua/neo-tree/ui/renderer.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ end
348348
M.position = {
349349
save = function(state)
350350
if state.tree and M.window_exists(state) then
351-
local node = state.tree:get_node()
352-
if node then
353-
state.position.node_id = node:get_id()
351+
local success, node = pcall(state.tree.get_node, state.tree)
352+
if success and node then
353+
_, state.position.node_id = pcall(node.get_id, node)
354354
end
355355
end
356356
-- Only need to restore the cursor state once per save, comes

0 commit comments

Comments
 (0)