mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
project_panel: Improve wording around file deletion (#43801)
Make it clear in the UI that "Delete" of file or folder is permanent action. For example in windows explorer and VS Code "Delete" means move to trash. Or maybe also remove permanent delete from the context menu completely and allow it only through keyboard shortcut, like it's in Windows Explorer, VS Code and KDE Dolphin file manager. Release Notes: - Improved wording within file deletion prompts in the projetct panel. --------- Co-authored-by: MrSubidubi <finn@zed.dev>
This commit is contained in:
parent
4bd1a090d9
commit
a8d0cdb559
1 changed files with 15 additions and 4 deletions
|
|
@ -2371,6 +2371,11 @@ impl ProjectPanel {
|
|||
}
|
||||
let answer = if !skip_prompt {
|
||||
let operation = if trash { "Trash" } else { "Delete" };
|
||||
let message_start = if trash {
|
||||
"Do you want to trash"
|
||||
} else {
|
||||
"Are you sure you want to permanently delete"
|
||||
};
|
||||
let prompt = match file_paths.first() {
|
||||
Some((_, path)) if file_paths.len() == 1 => {
|
||||
let unsaved_warning = if dirty_buffers > 0 {
|
||||
|
|
@ -2379,7 +2384,7 @@ impl ProjectPanel {
|
|||
""
|
||||
};
|
||||
|
||||
format!("{operation} {path}?{unsaved_warning}")
|
||||
format!("{message_start} {path}?{unsaved_warning}")
|
||||
}
|
||||
_ => {
|
||||
const CUTOFF_POINT: usize = 10;
|
||||
|
|
@ -2411,14 +2416,20 @@ impl ProjectPanel {
|
|||
};
|
||||
|
||||
format!(
|
||||
"Do you want to {} the following {} files?\n{}{unsaved_warning}",
|
||||
operation.to_lowercase(),
|
||||
"{message_start} the following {} files?\n{}{unsaved_warning}",
|
||||
file_paths.len(),
|
||||
names.join("\n")
|
||||
)
|
||||
}
|
||||
};
|
||||
Some(window.prompt(PromptLevel::Info, &prompt, None, &[operation, "Cancel"], cx))
|
||||
let detail = (!trash).then_some("This cannot be undone.");
|
||||
Some(window.prompt(
|
||||
PromptLevel::Info,
|
||||
&prompt,
|
||||
detail,
|
||||
&[operation, "Cancel"],
|
||||
cx,
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue