From 84b945e89d319e689cc8fc6a0779af49e7768cf8 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Sat, 25 Jan 2025 21:35:01 -0700 Subject: [PATCH] Revert making keybinding display in Mac menus use standard precedence (#23661) Closes #23621 Change was in #23378. Also adds a comment to clarify why this is inconsistent with all other uses of `bindings_for_action`. Release Notes: - N/A --- crates/gpui/src/platform/mac/platform.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index 0d496e49f9..8fa7d4ffa6 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -290,9 +290,13 @@ impl MacPlatform { action, os_action, } => { + // Note that this is not the standard logic for selecting which keybinding to + // display. Typically the last binding takes precedence for display. However, in + // this case the menus are not updated on context changes. To make these bindings + // more likely to be correct, the first binding instead takes precedence (typically + // from the base keymap). let keystrokes = keymap .bindings_for_action(action.as_ref()) - .rev() .next() .map(|binding| binding.keystrokes());