Git commit modal command (#26405)

Fix KeyBinding::for_action() to use the active focus handle instead of
what was
rendered last.

This makes the UI consistently chose the cmd-escape binding for close
(because escape in the editor is editor::Cancel?),
so force it to be "escape"

Release Notes:

- git: Fixed escape tooltip in commit modal
This commit is contained in:
Conrad Irwin 2025-03-10 16:10:53 -06:00 committed by GitHub
parent 1f8b14f4f1
commit 4d1d8d6d78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 8 additions and 11 deletions

View file

@ -29,6 +29,9 @@ impl KeyBinding {
/// Returns the highest precedence keybinding for an action. This is the last binding added to
/// the keymap. User bindings are added after built-in bindings so that they take precedence.
pub fn for_action(action: &dyn Action, window: &mut Window, cx: &App) -> Option<Self> {
if let Some(focused) = window.focused(cx) {
return Self::for_action_in(action, &focused, window, cx);
}
let key_binding =
gpui::Keymap::binding_to_display_from_bindings(&window.bindings_for_action(action))
.cloned()?;