summaryrefslogtreecommitdiffstats
path: root/src/tab.rs
diff options
context:
space:
mode:
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