refactor(#2826): multi instance nvim-tree.view

This commit is contained in:
Mateusz Russak
2024-08-04 13:31:11 +02:00
parent 0f2cda6ce0
commit fa051cf990
22 changed files with 390 additions and 297 deletions

View File

@@ -1,5 +1,4 @@
local log = require "nvim-tree.log"
local view = require "nvim-tree.view"
local utils = require "nvim-tree.utils"
local renderer = require "nvim-tree.renderer"
local reload = require "nvim-tree.explorer.reload"
@@ -13,7 +12,8 @@ local running = {}
---Find a path in the tree, expand it and focus it
---@param path string relative or absolute
function M.fn(path)
if not core.get_explorer() or not view.is_visible() then
local explorer = core.get_explorer()
if not explorer or not explorer.view:is_visible() then
return
end
@@ -75,9 +75,9 @@ function M.fn(path)
end)
:iterate()
if found and view.is_visible() then
if found and explorer.view:is_visible() then
renderer.draw()
view.set_cursor { line, 0 }
explorer.view:set_cursor { line, 0 }
end
running[path_real] = false