mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
keymap_editor: Clear action query when showing matching keybindings (#41296)
Closes https://github.com/zed-industries/zed/issues/41050 Release Notes: - Fixed an issue where showing matching keystrokes in the keybind editor modal would not clear an active text query.
This commit is contained in:
parent
a70f80df95
commit
1ae8e0c53a
1 changed files with 14 additions and 6 deletions
|
|
@ -521,6 +521,11 @@ impl KeymapEditor {
|
|||
}
|
||||
}
|
||||
|
||||
fn clear_action_query(&self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
self.filter_editor
|
||||
.update(cx, |editor, cx| editor.clear(window, cx))
|
||||
}
|
||||
|
||||
fn on_query_changed(&mut self, cx: &mut Context<Self>) {
|
||||
let action_query = self.current_action_query(cx);
|
||||
let keystroke_query = self.current_keystroke_query(cx);
|
||||
|
|
@ -2447,7 +2452,7 @@ impl KeybindingEditorModal {
|
|||
}
|
||||
|
||||
fn get_matching_bindings_count(&self, cx: &Context<Self>) -> usize {
|
||||
let current_keystrokes = self.keybind_editor.read(cx).keystrokes().to_vec();
|
||||
let current_keystrokes = self.keybind_editor.read(cx).keystrokes();
|
||||
|
||||
if current_keystrokes.is_empty() {
|
||||
return 0;
|
||||
|
|
@ -2464,17 +2469,20 @@ impl KeybindingEditorModal {
|
|||
return false;
|
||||
}
|
||||
|
||||
binding
|
||||
.keystrokes()
|
||||
.map(|keystrokes| keystrokes_match_exactly(keystrokes, ¤t_keystrokes))
|
||||
.unwrap_or(false)
|
||||
binding.keystrokes().is_some_and(|keystrokes| {
|
||||
keystrokes_match_exactly(keystrokes, current_keystrokes)
|
||||
})
|
||||
})
|
||||
.count()
|
||||
}
|
||||
|
||||
fn show_matching_bindings(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
|
||||
fn show_matching_bindings(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
let keystrokes = self.keybind_editor.read(cx).keystrokes().to_vec();
|
||||
|
||||
self.keymap_editor.update(cx, |keymap_editor, cx| {
|
||||
keymap_editor.clear_action_query(window, cx)
|
||||
});
|
||||
|
||||
// Dismiss the modal
|
||||
cx.emit(DismissEvent);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue