refactor(#2942): multi instance: remove unnecessary focus_file
This commit is contained in:
parent
660c42a0ac
commit
df94463e76
@ -49,7 +49,7 @@ function M.fn(direction)
|
||||
end
|
||||
|
||||
if target_node then
|
||||
explorer:focus_file(target_node.absolute_path)
|
||||
explorer:focus_node_or_parent(target_node)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -599,14 +599,6 @@ function Explorer:get_node_from_path(path)
|
||||
:iterate()
|
||||
end
|
||||
|
||||
---@param path string
|
||||
function Explorer:focus_file(path)
|
||||
local _, i = self:find_node(function(node)
|
||||
return node.absolute_path == path
|
||||
end)
|
||||
view.set_cursor({ i + 1, 1 })
|
||||
end
|
||||
|
||||
---Focus node passed as parameter if visible, otherwise focus first visible parent.
|
||||
---If none of the parents is visible focus root.
|
||||
---If node is nil do nothing.
|
||||
@ -619,7 +611,7 @@ function Explorer:focus_node_or_parent(node)
|
||||
end)
|
||||
|
||||
if found_node or node.parent == nil then
|
||||
require("nvim-tree.view").set_cursor({ i + 1, 1 })
|
||||
view.set_cursor({ i + 1, 1 })
|
||||
break
|
||||
end
|
||||
|
||||
|
||||
@ -220,9 +220,9 @@ function LiveFilter:clear_filter()
|
||||
self.explorer.renderer:draw()
|
||||
|
||||
if node then
|
||||
self.explorer:focus_file(node.absolute_path)
|
||||
self.explorer:focus_node_or_parent(node)
|
||||
elseif last_node then
|
||||
self.explorer:focus_file(last_node.absolute_path)
|
||||
self.explorer:focus_node_or_parent(last_node)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ function Marks:navigate_select()
|
||||
if node and not node:is(DirectoryNode) and not utils.get_win_buf_from_path(node.absolute_path) then
|
||||
open_file.fn("edit", node.absolute_path)
|
||||
elseif node then
|
||||
self.explorer:focus_file(node.absolute_path)
|
||||
self.explorer:focus_node_or_parent(node)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user