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 = {
88 Ready = " Ready" ,
99 WillRenameNode = " WillRenameNode" ,
1010 NodeRenamed = " NodeRenamed" ,
11+ TreePreOpen = " TreePreOpen" ,
1112 TreeOpen = " TreeOpen" ,
13+ TreePreClose = " TreePreClose" ,
1214 TreeClose = " TreeClose" ,
1315 WillCreateFile = " WillCreateFile" ,
1416 FileCreated = " FileCreated" ,
@@ -91,11 +93,21 @@ function M._dispatch_folder_removed(folder_name)
9193 dispatch (M .Event .FolderRemoved , { folder_name = folder_name })
9294end
9395
96+ -- @private
97+ function M ._dispatch_on_tree_pre_open ()
98+ dispatch (M .Event .TreePreOpen , nil )
99+ end
100+
94101-- @private
95102function M ._dispatch_on_tree_open ()
96103 dispatch (M .Event .TreeOpen , nil )
97104end
98105
106+ -- @private
107+ function M ._dispatch_on_tree_pre_close ()
108+ dispatch (M .Event .TreePreClose , nil )
109+ end
110+
99111-- @private
100112function M ._dispatch_on_tree_close ()
101113 dispatch (M .Event .TreeClose , nil )
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ function M.open(opts)
110110
111111 local explorer = core .get_explorer ()
112112
113+ events ._dispatch_on_tree_pre_open ()
113114 if should_hijack_current_buf () then
114115 view .close_this_tab_only ()
115116 view .open_in_win ()
Original file line number Diff line number Diff line change @@ -238,6 +238,7 @@ local function close(tabpage)
238238 return
239239 end
240240 save_tab_state (tabpage )
241+ events ._dispatch_on_tree_pre_close ()
241242 switch_buf_if_last_buf ()
242243 local tree_win = M .get_winnr (tabpage )
243244 local current_win = vim .api .nvim_get_current_win ()
@@ -289,6 +290,7 @@ function M.open(options)
289290
290291 local profile = log .profile_start (" view open" )
291292
293+ events ._dispatch_on_tree_pre_open ()
292294 create_buffer ()
293295 open_window ()
294296 M .resize ()
You can’t perform that action at this time.
0 commit comments