refacto: move target_winid outside of tree

This commit is contained in:
kiyan
2022-02-06 17:03:23 +01:00
parent 74791bb624
commit 8b27fd4e61
2 changed files with 10 additions and 9 deletions

View File

@@ -10,12 +10,13 @@ local git = require'nvim-tree.git'
local first_init_done = false
local M = {}
local M = {
target_winid = nil,
}
M.Tree = {
nodes = {},
cwd = nil,
target_winid = nil,
}
local function load_children(cwd, children, parent)
@@ -115,11 +116,11 @@ function M.set_target_win()
local id = api.nvim_get_current_win()
local tree_id = view.get_winnr()
if tree_id and id == tree_id then
M.Tree.target_winid = 0
M.target_winid = 0
return
end
M.Tree.target_winid = id
M.target_winid = id
end
function M.open()