363363
364364--- @private
365365function View :grow ()
366- local starts_at = M . is_root_folder_visible (require (" nvim-tree.core" ).get_cwd ()) and 1 or 0
366+ local starts_at = self : is_root_folder_visible (require (" nvim-tree.core" ).get_cwd ()) and 1 or 0
367367 local lines = vim .api .nvim_buf_get_lines (M .get_bufnr (), starts_at , - 1 , false )
368368 -- number of columns of right-padding to indicate end of path
369369 local padding = self :get_size (self .padding )
@@ -539,15 +539,15 @@ end
539539
540540--- @param winnr number | nil
541541--- @param open_if_closed boolean | nil
542- function M . focus (winnr , open_if_closed )
542+ function View : focus (winnr , open_if_closed )
543543 local wnr = winnr or M .get_winnr ()
544544
545545 if vim .api .nvim_win_get_tabpage (wnr or 0 ) ~= vim .api .nvim_win_get_tabpage (0 ) then
546- M . close ()
547- M . View :open ()
546+ self : close ()
547+ self :open ()
548548 wnr = M .get_winnr ()
549- elseif open_if_closed and not M . View :is_visible () then
550- M . View :open ()
549+ elseif open_if_closed and not self :is_visible () then
550+ self :open ()
551551 end
552552
553553 if wnr then
@@ -558,22 +558,22 @@ end
558558--- Retrieve the winid of the open tree.
559559--- @param opts ApiTreeWinIdOpts | nil
560560--- @return number | nil winid unlike get_winnr (), this returns nil if the nvim-tree window is not visible
561- function M . winid (opts )
561+ function View : winid (opts )
562562 local tabpage = opts and opts .tabpage
563563 if tabpage == 0 then
564564 tabpage = vim .api .nvim_get_current_tabpage ()
565565 end
566- if M . View :is_visible ({ tabpage = tabpage }) then
566+ if self :is_visible ({ tabpage = tabpage }) then
567567 return M .get_winnr (tabpage )
568568 else
569569 return nil
570570 end
571571end
572572
573573--- Restores the state of a NvimTree window if it was initialized before.
574- function M . restore_tab_state ()
574+ function View : restore_tab_state ()
575575 local tabpage = vim .api .nvim_get_current_tabpage ()
576- M . View :set_cursor (M . View .cursors [tabpage ])
576+ self :set_cursor (self .cursors [tabpage ])
577577end
578578
579579--- Returns the window number for nvim-tree within the tabpage specified
643643
644644--- @param cwd string | nil
645645--- @return boolean
646- function M . is_root_folder_visible (cwd )
647- return cwd ~= " /" and not M . View .hide_root_folder
646+ function View : is_root_folder_visible (cwd )
647+ return cwd ~= " /" and not self .hide_root_folder
648648end
649649
650650-- used on ColorScheme event
0 commit comments