Skip to content

Commit

Permalink
fix: fixes #79, fix second+ invocation of NeoTreeShow
Browse files Browse the repository at this point in the history
  • Loading branch information
cseickel committed Jan 21, 2022
1 parent 26987d1 commit edfdf0e
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lua/neo-tree/sources/filesystem/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,27 @@ M.follow = function(callback, force_show)
if not utils.truthy(path_to_reveal) then
return false
end

local state = get_state()
if not force_show and not renderer.window_exists(state) then
return false
local window_exists = renderer.window_exists(state)
if window_exists then
local node = state.tree and state.tree:get_node()
if node then
if node:get_id() == path_to_reveal then
-- already focused
return false
end
end
else
if not force_show then
return false
end
end

local is_in_path = path_to_reveal:sub(1, #state.path) == state.path
if not is_in_path then
return false
end
local node = state.tree and state.tree:get_node()
if node then
if node:get_id() == path_to_reveal then
-- already focused
return false
end
end

log.debug("follow file: ", path_to_reveal)
local show_only_explicitly_opened = function()
Expand Down

0 comments on commit edfdf0e

Please sign in to comment.