chore: remove TreePreClose event and update dispatch of TreePreOpen
This commit is contained in:
parent
a68a114439
commit
635bbf0023
@ -2781,13 +2781,9 @@ e.g. handler for node renamed: >lua
|
||||
Invoked after the NvimTree is opened.
|
||||
• Note: Handler takes no parameter.
|
||||
|
||||
- Event.TreePreClose
|
||||
Invoked before the window and buffer for NvimTree are closed.
|
||||
Before |Event.TreeClose| event.
|
||||
• Note: Handler takes no parameter.
|
||||
|
||||
- Event.TreeClose
|
||||
Invoked after the NvimTree is closed.
|
||||
Invoked after the NvimTree is closed, but before the window is
|
||||
closed. Dispatched on |WinClosed| event for NvimTree window.
|
||||
• Note: Handler takes no parameter.
|
||||
|
||||
- Event.Resize - When NvimTree is resized.
|
||||
|
||||
@ -10,7 +10,6 @@ M.Event = {
|
||||
NodeRenamed = "NodeRenamed",
|
||||
TreePreOpen = "TreePreOpen",
|
||||
TreeOpen = "TreeOpen",
|
||||
TreePreClose = "TreePreClose",
|
||||
TreeClose = "TreeClose",
|
||||
WillCreateFile = "WillCreateFile",
|
||||
FileCreated = "FileCreated",
|
||||
@ -103,11 +102,6 @@ function M._dispatch_on_tree_open()
|
||||
dispatch(M.Event.TreeOpen, nil)
|
||||
end
|
||||
|
||||
--@private
|
||||
function M._dispatch_on_tree_pre_close()
|
||||
dispatch(M.Event.TreePreClose, nil)
|
||||
end
|
||||
|
||||
--@private
|
||||
function M._dispatch_on_tree_close()
|
||||
dispatch(M.Event.TreeClose, nil)
|
||||
|
||||
@ -109,7 +109,6 @@ function M.open(opts)
|
||||
|
||||
local explorer = core.get_explorer()
|
||||
|
||||
events._dispatch_on_tree_pre_open()
|
||||
if should_hijack_current_buf() then
|
||||
view.close_this_tab_only()
|
||||
view.open_in_win()
|
||||
|
||||
@ -238,7 +238,6 @@ local function close(tabpage)
|
||||
return
|
||||
end
|
||||
save_tab_state(tabpage)
|
||||
events._dispatch_on_tree_pre_close()
|
||||
switch_buf_if_last_buf()
|
||||
local tree_win = M.get_winnr(tabpage)
|
||||
local current_win = vim.api.nvim_get_current_win()
|
||||
@ -415,6 +414,7 @@ end
|
||||
---@param opts OpenInWinOpts|nil
|
||||
function M.open_in_win(opts)
|
||||
opts = opts or { hijack_current_buf = true, resize = true }
|
||||
events._dispatch_on_tree_pre_open()
|
||||
if opts.winid and vim.api.nvim_win_is_valid(opts.winid) then
|
||||
vim.api.nvim_set_current_win(opts.winid)
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user