pub struct Tree {
pub lines: Box<[TreeLine]>,
pub selection: usize,
pub options: TreeOptions,
pub scroll: usize,
pub total_search: bool,
pub git_status: ComputationResult<TreeGitStatus>,
pub build_report: BuildReport,
}
Expand description
The tree which may be displayed, with onle line per visible line of the panel.
In the tree structure, every “node” is just a line, there’s no link from a child to its parent or from a parent to its children.
Fields§
§lines: Box<[TreeLine]>
§selection: usize
§options: TreeOptions
§scroll: usize
§total_search: bool
§git_status: ComputationResult<TreeGitStatus>
§build_report: BuildReport
Implementations§
source§impl Tree
impl Tree
sourcepub fn refresh(
&mut self,
page_height: usize,
con: &AppContext
) -> Result<(), TreeBuildError>
pub fn refresh( &mut self, page_height: usize, con: &AppContext ) -> Result<(), TreeBuildError>
rebuild the tree with the same root, height, and options
sourcepub fn after_lines_changed(&mut self)
pub fn after_lines_changed(&mut self)
do what must be done after line additions or removals:
- sort the lines
- compute left branches
pub fn is_empty(&self) -> bool
pub fn has_branch(&self, line_index: usize, depth: usize) -> bool
sourcepub fn move_selection(&mut self, dy: i32, page_height: usize, cycle: bool)
pub fn move_selection(&mut self, dy: i32, page_height: usize, cycle: bool)
select another line
For example the following one if dy is 1.
sourcepub fn try_scroll(&mut self, dy: i32, page_height: usize) -> bool
pub fn try_scroll(&mut self, dy: i32, page_height: usize) -> bool
Scroll the desired amount and return true, or return false if it’s already at end or the tree fits the page
sourcepub fn try_select_y(&mut self, y: usize) -> bool
pub fn try_select_y(&mut self, y: usize) -> bool
try to select a line by index of visible line (works if y+scroll falls on a selectable line)
pub fn make_selection_visible(&mut self, page_height: usize)
pub fn selected_line(&self) -> &TreeLine
pub fn root(&self) -> &PathBuf
sourcepub fn try_select_best_match(&mut self)
pub fn try_select_best_match(&mut self)
select the line with the best matching score
sourcepub fn try_select_path(&mut self, path: &Path) -> bool
pub fn try_select_path(&mut self, path: &Path) -> bool
return true when we could select the given path
pub fn try_select_first(&mut self) -> bool
pub fn try_select_last(&mut self, page_height: usize) -> bool
pub fn try_select_previous_same_depth(&mut self, page_height: usize) -> bool
pub fn try_select_next_same_depth(&mut self, page_height: usize) -> bool
pub fn try_select_previous_filtered<F>( &mut self, filter: F, page_height: usize ) -> bool
pub fn try_select_next_filtered<F>( &mut self, filter: F, page_height: usize ) -> bool
pub fn has_dir_missing_sum(&self) -> bool
pub fn is_missing_git_status_computation(&self) -> bool
sourcepub fn fetch_regular_file_sums(&mut self)
pub fn fetch_regular_file_sums(&mut self)
fetch the file_sums of regular files (thus avoiding the long computation which is needed for directories)
sourcepub fn fetch_some_missing_dir_sum(&mut self, dam: &Dam, con: &AppContext)
pub fn fetch_some_missing_dir_sum(&mut self, dam: &Dam, con: &AppContext)
compute the file_sum of one directory
To compute the size of all of them, this should be called until has_dir_missing_sum returns false