refacto: set tree explorer in the global state

also remove the redraw method and use renderer.draw immediately
This commit is contained in:
kiyan
2022-02-07 22:07:08 +01:00
parent e42a4337d0
commit ea92e7bf7c
18 changed files with 85 additions and 93 deletions

View File

@@ -9,7 +9,7 @@ local M = {}
local function focus_file(file)
local _, i = utils.find_node(
lib.Tree.nodes,
TreeExplorer.nodes,
function(node) return node.absolute_path == file end
)
require'nvim-tree.view'.set_cursor({i+1, 1})
@@ -61,8 +61,8 @@ function M.fn(node)
node = lib.get_last_group_node(node)
if node.name == '..' then
node = {
absolute_path = lib.Tree.cwd,
nodes = lib.Tree.nodes,
absolute_path = TreeExplorer.cwd,
nodes = TreeExplorer.nodes,
open = true,
}
end