summaryrefslogtreecommitdiffstats
path: root/src/commands/parent_directory.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/parent_directory.rs')
-rw-r--r--src/commands/parent_directory.rs20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/commands/parent_directory.rs b/src/commands/parent_directory.rs
index e514f94..ee3c621 100644
--- a/src/commands/parent_directory.rs
+++ b/src/commands/parent_directory.rs
@@ -2,7 +2,7 @@ use crate::commands::{JoshutoCommand, JoshutoRunnable};
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
use crate::history::DirectoryHistory;
-use crate::window::JoshutoView;
+use crate::ui::TuiBackend;
#[derive(Clone, Debug)]
pub struct ParentDirectory;
@@ -17,25 +17,13 @@ impl ParentDirectory {
pub fn parent_directory(
context: &mut JoshutoContext,
- view: &JoshutoView,
+ backend: &mut TuiBackend,
) -> std::io::Result<()> {
let curr_tab = &mut context.tabs[context.curr_tab_index];
if !curr_tab.curr_path.pop() {
return Ok(());
}
std::env::set_current_dir(&curr_tab.curr_path)?;
-
- let mut new_curr_list = curr_tab
- .history
- .pop_or_create(&curr_tab.curr_path, &context.config_t.sort_option)?;
-
- std::mem::swap(&mut curr_tab.curr_list, &mut new_curr_list);
- curr_tab
- .history
- .insert(new_curr_list.file_path().clone(), new_curr_list);
-
- curr_tab.refresh(view, &context.config_t);
- ncurses::doupdate();
Ok(())
}
}
@@ -49,8 +37,8 @@ impl std::fmt::Display for ParentDirectory {
}
impl JoshutoRunnable for ParentDirectory {
- fn execute(&self, context: &mut JoshutoContext, view: &JoshutoView) -> JoshutoResult<()> {
- Self::parent_directory(context, view)?;
+ fn execute(&self, context: &mut JoshutoContext, backend: &mut TuiBackend) -> JoshutoResult<()> {
+ Self::parent_directory(context, backend)?;
Ok(())
}
}