From 08502d67ae37cb0212e262d884a90a645dd79a1a Mon Sep 17 00:00:00 2001 From: IlYoung Date: Mon, 7 Sep 2026 16:23:05 +0000 Subject: [PATCH] ui: Fix modifier key hints on macOS (#63807) # Objective Fixes #63805 ## Solution change alt -> option! ## Testing I built it and saw. ## Self-Review Checklist: - [y] I've reviewed my own diff for quality, security, and reliability - [y] Unsafe blocks (if any) have justifying comments - [y] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [n] Tests cover the new/changed behavior (no behavior change) - [y] Performance impact has been considered and is acceptable ## Showcase image --- Release Notes: - Fixed hints for branch and worktree deletion, keybinding conflicts, and edit predictions referring to Alt instead of Option on macOS. --------- Co-authored-by: Smit Barmase --- .../src/edit_prediction_button.rs | 7 ++++++- crates/git_ui/src/branch_picker.rs | 2 +- crates/git_ui_core/src/worktree_picker.rs | 2 +- crates/keymap_editor/src/keymap_editor.rs | 10 +++++++--- crates/ui/src/styles/platform.rs | 18 ++++++++++++++++++ 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/crates/edit_prediction_ui/src/edit_prediction_button.rs b/crates/edit_prediction_ui/src/edit_prediction_button.rs index 0a90a90b76..bd029b0a21 100644 --- a/crates/edit_prediction_ui/src/edit_prediction_button.rs +++ b/crates/edit_prediction_ui/src/edit_prediction_button.rs @@ -822,7 +822,12 @@ impl EditPredictionButton { ContextMenuEntry::new("Subtle") .toggleable(IconPosition::Start, subtle_mode) .documentation_aside(DocumentationSide::Left, move |_| { - Label::new("Display predictions inline only when holding a modifier key (alt by default).").into_any_element() + Label::new(concat!( + "Display predictions inline only when holding a modifier key (", + ui::alt_key_name!(), + " by default)." + )) + .into_any_element() }) .handler({ let fs = fs.clone(); diff --git a/crates/git_ui/src/branch_picker.rs b/crates/git_ui/src/branch_picker.rs index d9272e5fdf..a7989c422c 100644 --- a/crates/git_ui/src/branch_picker.rs +++ b/crates/git_ui/src/branch_picker.rs @@ -883,7 +883,7 @@ impl Render for DeleteBranchTooltip { Tooltip::with_meta_in( "Delete Branch", Some(&branch_picker::DeleteBranch), - "Hold alt to force delete", + concat!("Hold ", ui::alt_key_name!(), " to force delete"), &self.focus_handle, cx, ) diff --git a/crates/git_ui_core/src/worktree_picker.rs b/crates/git_ui_core/src/worktree_picker.rs index 5a4b278bbc..d518bee626 100644 --- a/crates/git_ui_core/src/worktree_picker.rs +++ b/crates/git_ui_core/src/worktree_picker.rs @@ -413,7 +413,7 @@ impl Render for DeleteWorktreeTooltip { Tooltip::with_meta_in( "Delete Worktree", Some(&DeleteWorktree), - "Hold alt to force delete", + concat!("Hold ", ui::alt_key_name!(), " to force delete"), &self.focus_handle, cx, ) diff --git a/crates/keymap_editor/src/keymap_editor.rs b/crates/keymap_editor/src/keymap_editor.rs index 7ce1740115..bc27d0b13b 100644 --- a/crates/keymap_editor/src/keymap_editor.rs +++ b/crates/keymap_editor/src/keymap_editor.rs @@ -1163,7 +1163,7 @@ impl KeymapEditor { Tooltip::with_meta( "View conflicts", Some(&ToggleConflictFilter), - "Use alt+click to show all conflicts", + concat!("Use ", ui::alt_key_name!(), "+click to show all conflicts"), cx, ) }) @@ -1193,11 +1193,15 @@ impl KeymapEditor { })) } else { base_button_style(index, IconName::Info) - .tooltip(|_window, cx| { + .tooltip(|_window, cx| { Tooltip::with_meta( "Show matching keybinds", Some(&ShowMatchingKeybinds), - "This binding is overridden by other bindings.\nUse alt+click to edit this binding", + concat!( + "This binding is overridden by other bindings.\nUse ", + ui::alt_key_name!(), + "+click to edit this binding" + ), cx, ) }) diff --git a/crates/ui/src/styles/platform.rs b/crates/ui/src/styles/platform.rs index 0d873a2ff2..cee7dfe013 100644 --- a/crates/ui/src/styles/platform.rs +++ b/crates/ui/src/styles/platform.rs @@ -1,3 +1,21 @@ +/// Expands to a literal so platform-specific hints can use `concat!` without allocating. +#[cfg(target_os = "macos")] +#[macro_export] +macro_rules! alt_key_name { + () => { + "option" + }; +} + +/// Expands to a literal so platform-specific hints can use `concat!` without allocating. +#[cfg(not(target_os = "macos"))] +#[macro_export] +macro_rules! alt_key_name { + () => { + "alt" + }; +} + /// The platform style to use when rendering UI. /// /// This can be used to abstract over platform differences.