refactor(#2826): View is an Explorer member
This commit is contained in:
@@ -144,10 +144,16 @@ function M.find_node(nodes, fn)
|
||||
return node.group_next and { node.group_next } or (node.open and #node.nodes > 0 and node.nodes)
|
||||
end)
|
||||
:iterate()
|
||||
i = require("nvim-tree.view").View:is_root_folder_visible() and i or i - 1
|
||||
if node and node.explorer.live_filter.filter then
|
||||
i = i + 1
|
||||
|
||||
if node then
|
||||
if not node.explorer.view:is_root_folder_visible() then
|
||||
i = i - 1
|
||||
end
|
||||
if node.explorer.live_filter.filter then
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
return node, i
|
||||
end
|
||||
|
||||
@@ -497,7 +503,10 @@ function M.focus_file(path)
|
||||
local _, i = M.find_node(require("nvim-tree.core").get_explorer().nodes, function(node)
|
||||
return node.absolute_path == path
|
||||
end)
|
||||
require("nvim-tree.view").View:set_cursor({ i + 1, 1 })
|
||||
local explorer = require("nvim-tree.core").get_explorer()
|
||||
if explorer then
|
||||
explorer.view:set_cursor({ i + 1, 1 })
|
||||
end
|
||||
end
|
||||
|
||||
---Focus node passed as parameter if visible, otherwise focus first visible parent.
|
||||
@@ -517,7 +526,7 @@ function M.focus_node_or_parent(node)
|
||||
end)
|
||||
|
||||
if found_node or node.parent == nil then
|
||||
require("nvim-tree.view").View:set_cursor({ i + 1, 1 })
|
||||
explorer.view:set_cursor({ i + 1, 1 })
|
||||
break
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user