chore: remove TreeExplorer global variable (#2561)

This commit is contained in:
Azad 2023-11-28 10:39:52 +01:00 committed by GitHub
parent d5cc938ab0
commit 05f55c1fd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -752,7 +752,7 @@ function M.purge_all_state()
view.abandon_all_windows()
if core.get_explorer() ~= nil then
git.purge_state()
TreeExplorer = nil
core.reset_explorer()
end
end

View File

@ -6,7 +6,7 @@ local log = require "nvim-tree.log"
local M = {}
TreeExplorer = nil
local TreeExplorer = nil
local first_init_done = false
function M.init(foldername)
@ -27,6 +27,10 @@ function M.get_explorer()
return TreeExplorer
end
function M.reset_explorer()
TreeExplorer = nil
end
function M.get_cwd()
return TreeExplorer and TreeExplorer.absolute_path
end

View File

@ -11,7 +11,7 @@ local function redraw()
end
local function reset_filter(node_)
node_ = node_ or TreeExplorer
node_ = node_ or require("nvim-tree.core").get_explorer()
Iterator.builder(node_.nodes)
:hidden()
:applier(function(node)
@ -79,7 +79,7 @@ function M.apply_filter(node_)
node.hidden = not (has_nodes or (ok and is_match))
end
iterate(node_ or TreeExplorer)
iterate(node_ or require("nvim-tree.core").get_explorer())
end
local function record_char()