Skip to content

Commit edfdf0e

Browse files
committed
fix: fixes #79, fix second+ invocation of NeoTreeShow
1 parent 26987d1 commit edfdf0e

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

lua/neo-tree/sources/filesystem/init.lua

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,21 +152,27 @@ M.follow = function(callback, force_show)
152152
if not utils.truthy(path_to_reveal) then
153153
return false
154154
end
155+
155156
local state = get_state()
156-
if not force_show and not renderer.window_exists(state) then
157-
return false
157+
local window_exists = renderer.window_exists(state)
158+
if window_exists then
159+
local node = state.tree and state.tree:get_node()
160+
if node then
161+
if node:get_id() == path_to_reveal then
162+
-- already focused
163+
return false
164+
end
165+
end
166+
else
167+
if not force_show then
168+
return false
169+
end
158170
end
171+
159172
local is_in_path = path_to_reveal:sub(1, #state.path) == state.path
160173
if not is_in_path then
161174
return false
162175
end
163-
local node = state.tree and state.tree:get_node()
164-
if node then
165-
if node:get_id() == path_to_reveal then
166-
-- already focused
167-
return false
168-
end
169-
end
170176

171177
log.debug("follow file: ", path_to_reveal)
172178
local show_only_explicitly_opened = function()

0 commit comments

Comments
 (0)