summaryrefslogtreecommitdiffstats
path: root/src/tree.rs
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2023-11-06 14:44:45 +0100
committerqkzk <qu3nt1n@gmail.com>2023-11-06 14:44:45 +0100
commit96eb525c48968251eb56bf5d311d00a19c26b96b (patch)
tree17fba59e7961314ddb59ce8273567089c8c01f84 /src/tree.rs
parent357b3c1bf637d5f4594b56f9997fe8475a12cca5 (diff)
FIX: move back from root should redo the parent tree
Diffstat (limited to 'src/tree.rs')
-rw-r--r--src/tree.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tree.rs b/src/tree.rs
index 08de5e7..2491314 100644
--- a/src/tree.rs
+++ b/src/tree.rs
@@ -165,6 +165,10 @@ impl Tree {
}
}
+ pub fn root_path(&self) -> &Path {
+ self.root_path.as_path()
+ }
+
pub fn selected_path(&self) -> &Path {
self.selected.as_path()
}
@@ -185,6 +189,10 @@ impl Tree {
Ok(self.selected.strip_prefix(&self.root_path)?)
}
+ pub fn is_on_root(&self) -> bool {
+ self.selected == self.root_path
+ }
+
/// Select next sibling or the next sibling of the parent
pub fn select_next(&mut self) -> Result<()> {
log::info!("select_next START {sel}", sel = self.selected.display());