summaryrefslogtreecommitdiffstats
path: root/src/commands/parent_directory.rs
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2020-08-29 22:06:19 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2020-08-29 22:08:23 -0400
commit5be4a5f472655a76e1430bad09a19f6ad111e474 (patch)
tree1fcffa6c8d37cc6d538b29b6fbd773e8de58512d /src/commands/parent_directory.rs
parent4f3842b56f1729dcd8e81c77f98253ed9dfb23b3 (diff)
big rework and dependency update
- abstract JoshutoContext implementation behind functions - rework io workers in an attempt to fix a bug - update dependencies - remove JoshutoContextWorker
Diffstat (limited to 'src/commands/parent_directory.rs')
-rw-r--r--src/commands/parent_directory.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/commands/parent_directory.rs b/src/commands/parent_directory.rs
index d6d05bd..72d629c 100644
--- a/src/commands/parent_directory.rs
+++ b/src/commands/parent_directory.rs
@@ -15,11 +15,10 @@ impl ParentDirectory {
}
pub fn parent_directory(context: &mut JoshutoContext) -> std::io::Result<()> {
- let curr_tab = &mut context.tabs[context.curr_tab_index];
- if !curr_tab.curr_path.pop() {
- return Ok(());
+ if context.tab_context_mut().curr_tab_mut().pwd_mut().pop() {
+ let path = context.tab_context_ref().curr_tab_ref().pwd();
+ std::env::set_current_dir(path)?;
}
- std::env::set_current_dir(&curr_tab.curr_path)?;
Ok(())
}
}
@@ -35,7 +34,7 @@ impl std::fmt::Display for ParentDirectory {
impl JoshutoRunnable for ParentDirectory {
fn execute(&self, context: &mut JoshutoContext, _: &mut TuiBackend) -> JoshutoResult<()> {
Self::parent_directory(context)?;
- ReloadDirList::soft_reload(context.curr_tab_index, context)?;
+ ReloadDirList::soft_reload(context.tab_context_ref().get_index(), context)?;
Ok(())
}
}