keymap_editor: Make "toggle exact match mode" the default for binding search (#42883)
I think having the "exact mode" turned on by default is usually what users will expect when searching for a specific keybinding. When it's turned off, it's very odd to search for a super common binding like "command-enter" and get no results. That happens because without that mode, we're trying to match for subsequent matches, which I'm betting it's an edge case. Hopefully, this change will make the keymap editor feel more like it works well. I'm also adding the toggle icon button inside the keystroke input for consistency with the project search input. Making this change very inspired by [Sam Rose's feedback](https://bsky.app/profile/samwho.dev/post/3m5juszqyd22w). Release Notes: - keymap editor: Made the "toggle exact match mode" the default keystroke search mode so that whatever you search for matches exactly to results.
This commit is contained in:
@@ -64,6 +64,7 @@ pub struct KeystrokeInput {
|
||||
clear_close_keystrokes_timer: Option<Task<()>>,
|
||||
#[cfg(test)]
|
||||
recording: bool,
|
||||
pub actions_slot: Option<AnyElement>,
|
||||
}
|
||||
|
||||
impl KeystrokeInput {
|
||||
@@ -94,6 +95,7 @@ impl KeystrokeInput {
|
||||
clear_close_keystrokes_timer: None,
|
||||
#[cfg(test)]
|
||||
recording: false,
|
||||
actions_slot: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,6 +447,11 @@ impl KeystrokeInput {
|
||||
// not get de-synced
|
||||
self.inner_focus_handle.is_focused(window)
|
||||
}
|
||||
|
||||
pub fn actions_slot(mut self, action: impl IntoElement) -> Self {
|
||||
self.actions_slot = Some(action.into_any_element());
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl EventEmitter<()> for KeystrokeInput {}
|
||||
@@ -586,7 +593,7 @@ impl Render for KeystrokeInput {
|
||||
.min_w_0()
|
||||
.justify_center()
|
||||
.flex_wrap()
|
||||
.gap(ui::DynamicSpacing::Base04.rems(cx))
|
||||
.gap_1()
|
||||
.children(self.render_keystrokes(is_recording)),
|
||||
)
|
||||
.child(
|
||||
@@ -636,6 +643,7 @@ impl Render for KeystrokeInput {
|
||||
)
|
||||
}
|
||||
})
|
||||
.when_some(self.actions_slot.take(), |this, action| this.child(action))
|
||||
.when(is_recording, |this| {
|
||||
this.child(
|
||||
IconButton::new("clear-btn", IconName::Backspace)
|
||||
|
||||
Reference in New Issue
Block a user