refactor(#2826): multi instance nvim-tree.view
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
local renderer = require "nvim-tree.renderer"
|
||||
local view = require "nvim-tree.view"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require "nvim-tree.lib"
|
||||
@@ -21,14 +20,20 @@ function M.fn(should_close)
|
||||
local parent = utils.get_parent_of_group(node).parent
|
||||
|
||||
if not parent or not parent.parent then
|
||||
return view.set_cursor { 1, 0 }
|
||||
local explorer = core.get_explorer()
|
||||
if explorer then
|
||||
return explorer.view:set_cursor { 1, 0 }
|
||||
end
|
||||
end
|
||||
|
||||
local _, line = utils.find_node(core.get_explorer().nodes, function(n)
|
||||
return n.absolute_path == parent.absolute_path
|
||||
end)
|
||||
|
||||
view.set_cursor { line + 1, 0 }
|
||||
local explorer = core.get_explorer()
|
||||
if explorer then
|
||||
explorer.view:set_cursor { line + 1, 0 }
|
||||
end
|
||||
if should_close then
|
||||
parent.open = false
|
||||
renderer.draw()
|
||||
|
||||
Reference in New Issue
Block a user