summaryrefslogtreecommitdiffstats
path: root/src/tab.rs
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2023-10-24 19:29:38 +0200
committerqkzk <qu3nt1n@gmail.com>2023-10-24 19:29:38 +0200
commitad86a843f89ca5d8fb37f802625261b740e1a145 (patch)
tree9ff896c53d66eea735f37a1575267ef4e47e180e /src/tab.rs
parentcd4e066f23cfe8f514a7038c8cebd35ef5764873 (diff)
Tree mode: file & directory are created in selected dir
Diffstat (limited to 'src/tab.rs')
-rw-r--r--src/tab.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/tab.rs b/src/tab.rs
index 0fe3eb3..8d7c4d2 100644
--- a/src/tab.rs
+++ b/src/tab.rs
@@ -413,16 +413,7 @@ impl Tab {
/// In normal mode it's the current working directory.
pub fn directory_of_selected(&self) -> Result<&path::Path> {
match self.mode {
- Mode::Tree => {
- let fileinfo = &self.directory.tree.current_node.fileinfo;
- match fileinfo.file_kind {
- FileKind::Directory => Ok(&self.directory.tree.current_node.fileinfo.path),
- _ => Ok(fileinfo
- .path
- .parent()
- .context("selected file should have a parent")?),
- }
- }
+ Mode::Tree => self.directory.tree.directory_of_selected(),
_ => Ok(&self.path_content.path),
}
}