refactor(#2826): more consistency checking
This commit is contained in:
parent
d72f85f524
commit
4d6c42356a
@ -74,7 +74,7 @@ end
|
|||||||
|
|
||||||
function M.tab_enter()
|
function M.tab_enter()
|
||||||
local explorer = core.get_explorer()
|
local explorer = core.get_explorer()
|
||||||
if explorer and explorer.view:is_visible({ any_tabpage = true }) then
|
if explorer and explorer.view:is_visible({ any_tabpage = true }, "nvim-tree.tab_enter") then
|
||||||
local bufname = vim.api.nvim_buf_get_name(0)
|
local bufname = vim.api.nvim_buf_get_name(0)
|
||||||
|
|
||||||
local ft
|
local ft
|
||||||
@ -97,7 +97,7 @@ end
|
|||||||
|
|
||||||
function M.open_on_directory()
|
function M.open_on_directory()
|
||||||
local explorer = core.get_explorer()
|
local explorer = core.get_explorer()
|
||||||
local should_proceed = _config.hijack_directories.auto_open or explorer and explorer.view:is_visible()
|
local should_proceed = _config.hijack_directories.auto_open or explorer and explorer.view:is_visible(nil, "nvim-tree.open_on_directory")
|
||||||
if not should_proceed then
|
if not should_proceed then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@ -13,7 +13,7 @@ local running = {}
|
|||||||
---@param path string relative or absolute
|
---@param path string relative or absolute
|
||||||
function M.fn(path)
|
function M.fn(path)
|
||||||
local explorer = core.get_explorer()
|
local explorer = core.get_explorer()
|
||||||
if not explorer or not explorer.view:is_visible() then
|
if not explorer or not explorer.view:is_visible(nil, "finders/find-file.fn1") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ function M.fn(path)
|
|||||||
end)
|
end)
|
||||||
:iterate()
|
:iterate()
|
||||||
|
|
||||||
if found and explorer.view:is_visible() then
|
if found and explorer.view:is_visible(nil, "finders/find-file.fn2") then
|
||||||
explorer.renderer:draw()
|
explorer.renderer:draw()
|
||||||
explorer.view:set_cursor({ line, 0 })
|
explorer.view:set_cursor({ line, 0 })
|
||||||
end
|
end
|
||||||
|
|||||||
@ -41,7 +41,7 @@ function M.fn(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local explorer = core.get_explorer()
|
local explorer = core.get_explorer()
|
||||||
if explorer and explorer.view:is_visible() then
|
if explorer and explorer.view:is_visible(nil, "tree/find-file.fn") then
|
||||||
-- focus
|
-- focus
|
||||||
if opts.focus then
|
if opts.focus then
|
||||||
lib.set_target_win()
|
lib.set_target_win()
|
||||||
|
|||||||
@ -25,7 +25,7 @@ function M.fn(opts)
|
|||||||
|
|
||||||
local explorer = core.get_explorer()
|
local explorer = core.get_explorer()
|
||||||
|
|
||||||
if explorer and explorer.view:is_visible() then
|
if explorer and explorer.view:is_visible(nil, "open.fn") then
|
||||||
-- focus
|
-- focus
|
||||||
lib.set_target_win()
|
lib.set_target_win()
|
||||||
explorer.view:focus()
|
explorer.view:focus()
|
||||||
|
|||||||
@ -42,7 +42,7 @@ function M.fn(opts, no_focus, cwd, bang)
|
|||||||
opts.path = nil
|
opts.path = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if explorer and explorer.view:is_visible() then
|
if explorer and explorer.view:is_visible(nil, "toggle.fn") then
|
||||||
-- close
|
-- close
|
||||||
explorer.view:close(nil, "toggle.fn")
|
explorer.view:close(nil, "toggle.fn")
|
||||||
else
|
else
|
||||||
|
|||||||
@ -532,7 +532,7 @@ function Explorer:reload_explorer()
|
|||||||
|
|
||||||
local projects = git.reload_all_projects()
|
local projects = git.reload_all_projects()
|
||||||
self:refresh_nodes(projects)
|
self:refresh_nodes(projects)
|
||||||
if self.view:is_visible() then
|
if self.view:is_visible(nil, "Explorer:reload_explorer") then
|
||||||
self.renderer:draw()
|
self.renderer:draw()
|
||||||
end
|
end
|
||||||
event_running = false
|
event_running = false
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user