summaryrefslogtreecommitdiffstats
path: root/src/tab.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/tab.rs
parent357b3c1bf637d5f4594b56f9997fe8475a12cca5 (diff)
FIX: move back from root should redo the parent tree
Diffstat (limited to 'src/tab.rs')
-rw-r--r--src/tab.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tab.rs b/src/tab.rs
index 400cd85..db5c08c 100644
--- a/src/tab.rs
+++ b/src/tab.rs
@@ -332,8 +332,17 @@ impl Tab {
/// Select the parent of current node.
/// If we were at the root node, move to the parent and make a new tree.
- pub fn tree_select_parent(&mut self) {
- self.tree.select_parent()
+ pub fn tree_select_parent(&mut self) -> Result<()> {
+ if self.tree.is_on_root() {
+ let Some(parent) = self.tree.root_path().parent() else {
+ return Ok(());
+ };
+ self.set_pathcontent(&parent.to_owned())?;
+ self.make_tree(Some(self.path_content.sort_kind.clone()))
+ } else {
+ self.tree.select_parent();
+ Ok(())
+ }
}
/// Move down 10 times in the tree