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
This commit is contained in:
Finn Evers 2025-07-10 17:01:36 +02:00 committed by GitHub
parent 5f21a9bd32
commit d7fd9245cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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