From d7fd9245cd71dd960cdc591722f94eeb65771d03 Mon Sep 17 00:00:00 2001 From: Finn Evers Date: Thu, 10 Jul 2025 17:01:36 +0200 Subject: [PATCH] settings_ui: Open keybinding editing modal on mouse double click (#34193) Whilst working on the keymap editor, I regularly find myself double-clicking an entry just to find that nothing happens besides selecting the given entry. This feels really unintuitive to me. I checked back with VSCode and they also open the modal when double-clicking an entry in the list. Thus, this PR enables double-clicking an entry in the list to open the editing modal. Release Notes: - N/A --- crates/settings_ui/src/keybindings.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/settings_ui/src/keybindings.rs b/crates/settings_ui/src/keybindings.rs index 9f6992173e..0e9b6307ae 100644 --- a/crates/settings_ui/src/keybindings.rs +++ b/crates/settings_ui/src/keybindings.rs @@ -10,9 +10,9 @@ use feature_flags::FeatureFlagViewExt; use fs::Fs; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - AppContext as _, AsyncApp, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - Global, KeyContext, Keystroke, ModifiersChangedEvent, ScrollStrategy, StyledText, Subscription, - WeakEntity, actions, div, + AppContext as _, AsyncApp, ClickEvent, Context, DismissEvent, Entity, EventEmitter, + FocusHandle, Focusable, Global, KeyContext, Keystroke, ModifiersChangedEvent, ScrollStrategy, + StyledText, Subscription, WeakEntity, actions, div, }; use language::{Language, LanguageConfig, ToOffset as _}; use settings::{BaseKeymap, KeybindSource, KeymapFile, SettingsAssets}; @@ -797,9 +797,14 @@ impl Render for KeymapEditor { let row = row .id(("keymap-table-row", row_index)) - .on_click(cx.listener(move |this, _event, _window, _cx| { - this.selected_index = Some(row_index); - })) + .on_click(cx.listener( + move |this, event: &ClickEvent, window, cx| { + this.selected_index = Some(row_index); + if event.up.click_count == 2 { + this.open_edit_keybinding_modal(false, window, cx); + } + }, + )) .border_2() .when(is_conflict, |row| { row.bg(cx.theme().status().error_background)