Fix forward Delete key icon (#65037)

<img width="2940" height="1720" alt="keymap-dark"
src="https://github.com/user-attachments/assets/f4c28b4f-6a33-4479-a24f-c95d64a790c3"
/>
Closes #64964.

Use a dedicated forward Delete icon (⌦) instead of Backspace (⌫). Add a
regression test for distinct icons.

Release Notes:

- Fixed identical Backspace and Delete icons in the keymap editor.
This commit is contained in:
Gautam Manchandani 2026-10-02 08:11:03 +00:00 • committed by GitHub
parent 651d693d42
commit 981b224a46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 1 deletions

7
assets/icons/delete.svg Normal file
View file

@ -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>

After

Width:  |  Height:  |  Size: 946 B

View file

@ -101,6 +101,7 @@ pub enum IconName {
DebugStepInto,
DebugStepOut,
DebugStepOver,
Delete,
Diff,
DiffSplit,
DiffSplitAuto,

View file

@ -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();