1- local  core  =  require  " nvim-tree.core" 
21local  notify  =  require  " nvim-tree.notify" 
32local  utils  =  require  " nvim-tree.utils" 
43local  view  =  require  " nvim-tree.view" 
@@ -41,7 +40,6 @@ local PICTURE_MAP = {
4140--- @field  extmarks  table[] extra marks for right icon placement 
4241--- @field  virtual_lines  table[] virtual lines for hidden count display 
4342--- @field  private  explorer Explorer 
44- --- @field  private  root_cwd string | nil absolute path 
4543--- @field  private  index number 
4644--- @field  private  depth number 
4745--- @field  private  combined_groups table<string ,  boolean> combined group names 
@@ -58,7 +56,6 @@ function Builder:new(opts, explorer)
5856  local  o  =  {
5957    opts  =  opts ,
6058    explorer  =  explorer ,
61-     root_cwd  =  core .get_cwd (),
6259    index  =  0 ,
6360    depth  =  0 ,
6461    hl_args  =  {},
@@ -157,7 +154,7 @@ function Builder:build_folder(node)
157154  local  foldername_hl  =  " NvimTreeFolderName" 
158155  if  node .link_to  and  self .opts .renderer .symlink_destination  then 
159156    local  arrow  =  icons .i .symlink_arrow 
160-     local  link_to  =  utils .path_relative (node .link_to , self .root_cwd )
157+     local  link_to  =  utils .path_relative (node .link_to , self .explorer . absolute_path )
161158    foldername  =  string.format (" %s%s%s"  , foldername , arrow , link_to )
162159    foldername_hl  =  " NvimTreeSymlinkFolderName" 
163160  elseif 
@@ -182,7 +179,7 @@ function Builder:build_symlink(node)
182179  local  arrow  =  icons .i .symlink_arrow 
183180  local  symlink_formatted  =  node .name 
184181  if  self .opts .renderer .symlink_destination  then 
185-     local  link_to  =  utils .path_relative (node .link_to , self .root_cwd )
182+     local  link_to  =  utils .path_relative (node .link_to , self .explorer . absolute_path )
186183    symlink_formatted  =  string.format (" %s%s%s"  , symlink_formatted , arrow , link_to )
187184  end 
188185
406403
407404--- @private 
408405function  Builder :get_nodes_number (nodes )
409-   local  explorer  =  core .get_explorer ()
410-   if  not  explorer  or  not  explorer .live_filter .filter  then 
406+   if  not  self .explorer .live_filter .filter  then 
411407    return  # nodes 
412408  end 
413409
423419--- @private 
424420function  Builder :build_lines (node )
425421  if  not  node  then 
426-     node  =  core . get_explorer () 
422+     node  =  self . explorer 
427423  end 
428424  local  num_children  =  self :get_nodes_number (node .nodes )
429425  local  idx  =  1 
@@ -442,28 +438,27 @@ end
442438--- @return  string 
443439function  Builder :format_root_name (root_label )
444440  if  type (root_label ) ==  " function"  then 
445-     local  label  =  root_label (self .root_cwd )
441+     local  label  =  root_label (self .explorer . absolute_path )
446442    if  type (label ) ==  " string"  then 
447443      return  label 
448444    end 
449445  elseif  type (root_label ) ==  " string"  then 
450-     return  utils .path_remove_trailing (vim .fn .fnamemodify (self .root_cwd , root_label ))
446+     return  utils .path_remove_trailing (vim .fn .fnamemodify (self .explorer . absolute_path , root_label ))
451447  end 
452448  return  " ???" 
453449end 
454450
455451--- @private 
456452function  Builder :build_header ()
457-   local  explorer  =  core .get_explorer ()
458-   if  view .is_root_folder_visible (core .get_cwd ()) then 
453+   if  view .is_root_folder_visible (self .explorer .absolute_path ) then 
459454    local  root_name  =  self :format_root_name (self .opts .renderer .root_folder_label )
460455    table.insert (self .lines , root_name )
461456    self :insert_highlight ({ " NvimTreeRootFolder"   }, 0 , string.len (root_name ))
462457    self .index  =  1 
463458  end 
464459
465-   if  explorer   and   explorer .live_filter .filter  then 
466-     local  filter_line  =  string.format (" %s/%s/"  , self .opts .live_filter .prefix , explorer .live_filter .filter )
460+   if  self . explorer .live_filter .filter  then 
461+     local  filter_line  =  string.format (" %s/%s/"  , self .opts .live_filter .prefix , self . explorer .live_filter .filter )
467462    table.insert (self .lines , filter_line )
468463    local  prefix_length  =  string.len (self .opts .live_filter .prefix )
469464    self :insert_highlight ({ " NvimTreeLiveFilterPrefix"   }, 0 , prefix_length )
0 commit comments