summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2023-01-31 11:39:53 -0500
committerJeff Zhao <jeff.no.zhao@gmail.com>2023-01-31 11:45:39 -0500
commite4f82ff773ae9a8c25357fbcf5fe7e13800bea7e (patch)
treebcf578bcb8c686d94d682c008c890dc21bd370b3
parentf37543832924dcbd75148739c6f71ec2efbfec95 (diff)
fix deleting preview before actual deletion
-rw-r--r--src/commands/delete_files.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/commands/delete_files.rs b/src/commands/delete_files.rs
index cdf4ced..496bbc1 100644
--- a/src/commands/delete_files.rs
+++ b/src/commands/delete_files.rs
@@ -30,13 +30,6 @@ fn delete_files(
));
}
- {
- let history = context.tab_context_mut().curr_tab_mut().history_mut();
- for path in paths.iter().filter(|p| p.is_dir()) {
- history.remove(path);
- }
- }
-
let ch = {
let prompt_str = format!("Delete {} files? (Y/n)", paths_len);
let mut prompt = TuiPrompt::new(&prompt_str);
@@ -65,13 +58,18 @@ fn delete_files(
};
let dest = path::PathBuf::new();
- let worker_thread = IoWorkerThread::new(file_op, paths, dest, options);
+ let worker_thread = IoWorkerThread::new(file_op, paths.clone(), dest, options);
if background {
context.worker_context_mut().push_worker(worker_thread);
} else {
let (wtx, _) = mpsc::channel();
worker_thread.start(wtx)?;
}
+
+ let history = context.tab_context_mut().curr_tab_mut().history_mut();
+ for path in paths.iter().filter(|p| p.is_dir()) {
+ history.remove(path);
+ }
}
Ok(())
}