diff options
author | qkzk <qu3nt1n@gmail.com> | 2023-11-06 14:44:45 +0100 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2023-11-06 14:44:45 +0100 |
commit | 96eb525c48968251eb56bf5d311d00a19c26b96b (patch) | |
tree | 17fba59e7961314ddb59ce8273567089c8c01f84 /src/tab.rs | |
parent | 357b3c1bf637d5f4594b56f9997fe8475a12cca5 (diff) |
FIX: move back from root should redo the parent tree
Diffstat (limited to 'src/tab.rs')
-rw-r--r-- | src/tab.rs | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 |