Skip to content

Commit 4d6c423

Browse files
committed
refactor(#2826): more consistency checking
1 parent d72f85f commit 4d6c423

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

lua/nvim-tree.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ end
7474

7575
function M.tab_enter()
7676
local explorer = core.get_explorer()
77-
if explorer and explorer.view:is_visible({ any_tabpage = true }) then
77+
if explorer and explorer.view:is_visible({ any_tabpage = true }, "nvim-tree.tab_enter") then
7878
local bufname = vim.api.nvim_buf_get_name(0)
7979

8080
local ft
@@ -97,7 +97,7 @@ end
9797

9898
function M.open_on_directory()
9999
local explorer = core.get_explorer()
100-
local should_proceed = _config.hijack_directories.auto_open or explorer and explorer.view:is_visible()
100+
local should_proceed = _config.hijack_directories.auto_open or explorer and explorer.view:is_visible(nil, "nvim-tree.open_on_directory")
101101
if not should_proceed then
102102
return
103103
end

lua/nvim-tree/actions/finders/find-file.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ local running = {}
1313
---@param path string relative or absolute
1414
function M.fn(path)
1515
local explorer = core.get_explorer()
16-
if not explorer or not explorer.view:is_visible() then
16+
if not explorer or not explorer.view:is_visible(nil, "finders/find-file.fn1") then
1717
return
1818
end
1919

@@ -83,7 +83,7 @@ function M.fn(path)
8383
end)
8484
:iterate()
8585

86-
if found and explorer.view:is_visible() then
86+
if found and explorer.view:is_visible(nil, "finders/find-file.fn2") then
8787
explorer.renderer:draw()
8888
explorer.view:set_cursor({ line, 0 })
8989
end

lua/nvim-tree/actions/tree/find-file.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function M.fn(opts)
4141
end
4242

4343
local explorer = core.get_explorer()
44-
if explorer and explorer.view:is_visible() then
44+
if explorer and explorer.view:is_visible(nil, "tree/find-file.fn") then
4545
-- focus
4646
if opts.focus then
4747
lib.set_target_win()

lua/nvim-tree/actions/tree/open.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function M.fn(opts)
2525

2626
local explorer = core.get_explorer()
2727

28-
if explorer and explorer.view:is_visible() then
28+
if explorer and explorer.view:is_visible(nil, "open.fn") then
2929
-- focus
3030
lib.set_target_win()
3131
explorer.view:focus()

lua/nvim-tree/actions/tree/toggle.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function M.fn(opts, no_focus, cwd, bang)
4242
opts.path = nil
4343
end
4444

45-
if explorer and explorer.view:is_visible() then
45+
if explorer and explorer.view:is_visible(nil, "toggle.fn") then
4646
-- close
4747
explorer.view:close(nil, "toggle.fn")
4848
else

lua/nvim-tree/explorer/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ function Explorer:reload_explorer()
532532

533533
local projects = git.reload_all_projects()
534534
self:refresh_nodes(projects)
535-
if self.view:is_visible() then
535+
if self.view:is_visible(nil, "Explorer:reload_explorer") then
536536
self.renderer:draw()
537537
end
538538
event_running = false

0 commit comments

Comments
 (0)