diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2020-03-20 11:55:27 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2020-03-20 11:55:27 -0400 |
commit | 84e912b7779faaaeb09d1085e09630a548c7fb54 (patch) | |
tree | 662665d1b7f1401ac9259bd6fa12e5e6aa2890ec /src/commands | |
parent | bd779fc6df4641f81bbbfe50663d883d64a5c88e (diff) |
Add more reloading triggers
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/delete_files.rs | 7 | ||||
-rw-r--r-- | src/commands/new_directory.rs | 11 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/commands/delete_files.rs b/src/commands/delete_files.rs index 85fe4b6..c70cee7 100644 --- a/src/commands/delete_files.rs +++ b/src/commands/delete_files.rs @@ -6,6 +6,7 @@ use termion::event::Key; use crate::commands::{JoshutoCommand, JoshutoRunnable, ReloadDirList}; use crate::context::JoshutoContext; use crate::error::JoshutoResult; +use crate::history::DirectoryHistory; use crate::ui::widgets::TuiPrompt; use crate::ui::TuiBackend; use crate::util::load_child::LoadChild; @@ -90,6 +91,12 @@ impl std::fmt::Display for DeleteFiles { impl JoshutoRunnable for DeleteFiles { fn execute(&self, context: &mut JoshutoContext, backend: &mut TuiBackend) -> JoshutoResult<()> { Self::delete_files(context, backend)?; + + let options = &context.config_t.sort_option; + let curr_path = context.tabs[context.curr_tab_index].curr_path.clone(); + for tab in context.tabs.iter_mut() { + tab.history.reload(&curr_path, options); + } LoadChild::load_child(context)?; Ok(()) } diff --git a/src/commands/new_directory.rs b/src/commands/new_directory.rs index ab7c170..ce27bc9 100644 --- a/src/commands/new_directory.rs +++ b/src/commands/new_directory.rs @@ -3,7 +3,9 @@ use std::path; use crate::commands::{JoshutoCommand, JoshutoRunnable, ReloadDirList}; use crate::context::JoshutoContext; use crate::error::JoshutoResult; +use crate::history::DirectoryHistory; use crate::ui::TuiBackend; +use crate::util::load_child::LoadChild; #[derive(Clone, Debug)] pub struct NewDirectory { @@ -32,7 +34,14 @@ impl JoshutoRunnable for NewDirectory { for path in &self.paths { std::fs::create_dir_all(path)?; } - ReloadDirList::reload(context.curr_tab_index, context)?; + + let options = &context.config_t.sort_option; + let curr_path = context.tabs[context.curr_tab_index].curr_path.clone(); + for tab in context.tabs.iter_mut() { + tab.history.reload(&curr_path, options); + } + + LoadChild::load_child(context)?; Ok(()) } } |