feat: message about deleting files should be different (#64)

This commit is contained in:
Pig Fang 2023-08-16 16:01:15 +08:00 committed by GitHub
parent 15fbb722aa
commit f510693beb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -187,7 +187,12 @@ impl Tasks {
pub fn file_remove(&self, targets: Vec<PathBuf>, permanently: bool) -> bool {
let scheduler = self.scheduler.clone();
tokio::spawn(async move {
let result = emit!(Input(InputOpt::hovered("Are you sure delete these files? (y/N)")));
let s = if targets.len() > 1 { 's' } else { ' ' };
let result = emit!(Input(InputOpt::hovered(if permanently {
format!("Sure to delete selected file{s} permanently? (y/N)")
} else {
format!("Sure to move selected file{s} to trash? (y/N)")
})));
if let Ok(choice) = result.await {
if choice.to_lowercase() != "y" {