Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix forward Delete key icon (#65037)

Gautam Manchandani981b224a46f2
diff --git a/assets/icons/delete.svg b/assets/icons/delete.svg
new file mode 100644
index 00000000000..cdb5d8b511b
--- /dev/null
+++ b/assets/icons/delete.svg
@@ -0,0 +1,7 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(16 0) scale(-1 1)">
+<path d="M6.79998 4C6.50183 4.00002 6.21436 4.10574 5.99358 4.29657L2.19677 7.57657C2.1348 7.63013 2.08528 7.69545 2.05139 7.76832C2.01751 7.8412 2 7.92001 2 7.99971C2 8.07941 2.01751 8.15823 2.05139 8.23111C2.08528 8.30398 2.1348 8.36929 2.19677 8.42286L5.99358 11.7034C6.21436 11.8943 6.50183 12 6.79998 12H12.8C13.1183 12 13.4235 11.8796 13.6485 11.6653C13.8736 11.4509 14 11.1602 14 10.8571V5.14286C14 4.83975 13.8736 4.54906 13.6485 4.33474C13.4235 4.12041 13.1183 4 12.8 4H6.79998Z" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M8.5 6.5L11.5 9.5" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M11.5 6.5L8.5 9.5" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
+</g>
+</svg>
diff --git a/crates/icons/src/icons.rs b/crates/icons/src/icons.rs
index 22ca64a5822..385a8468502 100644
--- a/crates/icons/src/icons.rs
+++ b/crates/icons/src/icons.rs
@@ -101,6 +101,7 @@ pub enum IconName {
DebugStepInto,
DebugStepOut,
DebugStepOver,
+ Delete,
Diff,
DiffSplit,
DiffSplitAuto,
diff --git a/crates/ui/src/components/keybinding.rs b/crates/ui/src/components/keybinding.rs
index cd58c284cb7..b4437e0ad5d 100644
--- a/crates/ui/src/components/keybinding.rs
+++ b/crates/ui/src/components/keybinding.rs
@@ -392,7 +392,7 @@ fn icon_for_key(key: &str, platform_style: PlatformStyle) -> Option<IconName> {
"up" => Some(IconName::ArrowUp),
"down" => Some(IconName::ArrowDown),
"backspace" => Some(IconName::Backspace),
- "delete" => Some(IconName::Backspace),
+ "delete" => Some(IconName::Delete),
"return" => Some(IconName::Return),
"enter" => Some(IconName::Return),
"tab" => Some(IconName::Tab),
@@ -848,6 +848,21 @@ impl Component for KeyBinding {
mod tests {
use super::*;
+ #[test]
+ fn test_backspace_and_delete_have_distinct_icons() {
+ for platform_style in [
+ PlatformStyle::Mac,
+ PlatformStyle::Linux,
+ PlatformStyle::Windows,
+ ] {
+ let backspace = icon_for_key("backspace", platform_style);
+ let delete = icon_for_key("delete", platform_style);
+ assert!(backspace.is_some());
+ assert!(delete.is_some());
+ assert_ne!(backspace, delete);
+ }
+ }
+
#[test]
fn test_text_for_keystroke() {
let keystroke = Keystroke::parse("cmd-c").unwrap();