File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,9 @@ M.Event = {
8
8
Ready = " Ready" ,
9
9
WillRenameNode = " WillRenameNode" ,
10
10
NodeRenamed = " NodeRenamed" ,
11
+ TreePreOpen = " TreePreOpen" ,
11
12
TreeOpen = " TreeOpen" ,
13
+ TreePreClose = " TreePreClose" ,
12
14
TreeClose = " TreeClose" ,
13
15
WillCreateFile = " WillCreateFile" ,
14
16
FileCreated = " FileCreated" ,
@@ -91,11 +93,21 @@ function M._dispatch_folder_removed(folder_name)
91
93
dispatch (M .Event .FolderRemoved , { folder_name = folder_name })
92
94
end
93
95
96
+ -- @private
97
+ function M ._dispatch_on_tree_pre_open ()
98
+ dispatch (M .Event .TreePreOpen , nil )
99
+ end
100
+
94
101
-- @private
95
102
function M ._dispatch_on_tree_open ()
96
103
dispatch (M .Event .TreeOpen , nil )
97
104
end
98
105
106
+ -- @private
107
+ function M ._dispatch_on_tree_pre_close ()
108
+ dispatch (M .Event .TreePreClose , nil )
109
+ end
110
+
99
111
-- @private
100
112
function M ._dispatch_on_tree_close ()
101
113
dispatch (M .Event .TreeClose , nil )
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ function M.open(opts)
110
110
111
111
local explorer = core .get_explorer ()
112
112
113
+ events ._dispatch_on_tree_pre_open ()
113
114
if should_hijack_current_buf () then
114
115
view .close_this_tab_only ()
115
116
view .open_in_win ()
Original file line number Diff line number Diff line change @@ -238,6 +238,7 @@ local function close(tabpage)
238
238
return
239
239
end
240
240
save_tab_state (tabpage )
241
+ events ._dispatch_on_tree_pre_close ()
241
242
switch_buf_if_last_buf ()
242
243
local tree_win = M .get_winnr (tabpage )
243
244
local current_win = vim .api .nvim_get_current_win ()
@@ -289,6 +290,7 @@ function M.open(options)
289
290
290
291
local profile = log .profile_start (" view open" )
291
292
293
+ events ._dispatch_on_tree_pre_open ()
292
294
create_buffer ()
293
295
open_window ()
294
296
M .resize ()
You can’t perform that action at this time.
0 commit comments