summaryrefslogtreecommitdiffstats
path: root/src/flat_tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/flat_tree.rs')
-rw-r--r--src/flat_tree.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/flat_tree.rs b/src/flat_tree.rs
index a5e0e1d..4627618 100644
--- a/src/flat_tree.rs
+++ b/src/flat_tree.rs
@@ -8,13 +8,14 @@ use std::{
};
#[cfg(unix)]
-use std::os::unix::fs::MetadataExt;
+use {
+ std::os::unix::fs::MetadataExt,
+ umask::Mode,
+};
#[cfg(windows)]
use is_executable::IsExecutable;
-use umask::Mode;
-
use crate::{
errors,
file_sizes::Size,
@@ -173,9 +174,9 @@ impl Tree {
Ok(())
}
- // do what must be done after line additions or removals:
- // - sort the lines
- // - compute left branchs
+ /// do what must be done after line additions or removals:
+ /// - sort the lines
+ /// - compute left branchs
pub fn after_lines_changed(&mut self) {
// we sort the lines (this is mandatory to avoid crashes)
self.lines[1..].sort();
@@ -245,6 +246,9 @@ impl Tree {
let line = &self.lines[line_index];
depth < usize::from(line.depth) && line.left_branchs[depth]
}
+ /// select another line
+ ///
+ /// For example the following one if dy is 1.
pub fn move_selection(&mut self, dy: i32, page_height: i32) {
// only work for +1 or -1
let l = self.lines.len();
@@ -427,6 +431,7 @@ impl Tree {
bsize.cmp(&asize)
});
}
+ /// compute and return the size of the root
pub fn total_size(&self) -> Size {
if let Some(size) = self.lines[0].size {
// if the real total size is computed, it's in the root line