Fix up keybindings propagation

Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
Piotr Osiewicz
2023-11-09 18:33:36 +01:00
co-authored by Conrad
parent d184e0d426
commit 194d615691
8 changed files with 41 additions and 13 deletions
+13
View File
@@ -44,6 +44,19 @@ impl KeyBinding {
pending_keystrokes: &[Keystroke],
contexts: &[&DispatchContext],
) -> KeyMatch {
let should_debug = self.keystrokes.len() == 1
&& self.keystrokes[0].key == "p"
&& self.keystrokes[0].modifiers.command == true
&& self.keystrokes[0].modifiers.shift == true;
if false && should_debug {
dbg!(
&self.keystrokes,
&pending_keystrokes,
&contexts,
&self.matches_context(contexts)
);
}
if self.keystrokes.as_ref().starts_with(&pending_keystrokes)
&& self.matches_context(contexts)
{
+1
View File
@@ -46,6 +46,7 @@ impl KeyMatcher {
keystroke: &Keystroke,
context_stack: &[&DispatchContext],
) -> KeyMatch {
dbg!(keystroke, &context_stack);
let keymap = self.keymap.lock();
// Clear pending keystrokes if the keymap has changed since the last matched keystroke.
if keymap.version() != self.keymap_version {