Merge branch 'master' into add-pre-events

This commit is contained in:
Alexander Courtis 2025-04-20 09:53:21 +10:00 committed by GitHub
commit a68a114439
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 3 deletions

View File

@ -236,6 +236,17 @@ local function setup_autocommands(opts)
end,
})
end
-- Handles event dispatch when tree is closed by `:q`
create_nvim_tree_autocmd("WinClosed", {
pattern = "*",
---@param ev vim.api.keyset.create_autocmd.callback_args
callback = function(ev)
if vim.api.nvim_get_option_value("filetype", { buf = ev.buf }) == "NvimTree" then
require("nvim-tree.events")._dispatch_on_tree_close()
end
end,
})
end
local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS

View File

@ -1,6 +1,5 @@
local view = require("nvim-tree.view")
local core = require("nvim-tree.core")
local events = require("nvim-tree.events")
local notify = require("nvim-tree.notify")
---@class LibOpenOpts
@ -131,7 +130,6 @@ function M.open(opts)
open_view_and_draw()
end
view.restore_tab_state()
events._dispatch_on_tree_open()
end
function M.setup(opts)

View File

@ -255,7 +255,6 @@ local function close(tabpage)
return
end
end
events._dispatch_on_tree_close()
return
end
end
@ -427,6 +426,7 @@ function M.open_in_win(opts)
M.reposition_window()
M.resize()
end
events._dispatch_on_tree_open()
end
function M.abandon_current_window()