fix(core): fix bug that prevented a matcher state invalidation on mouse clicks
This commit is contained in:
parent
eeec734d32
commit
10d37d1fe6
|
@ -68,15 +68,15 @@ impl<'a, State> Middleware for MatcherMiddleware<'a, State> {
|
||||||
matcher_states.pop_back();
|
matcher_states.pop_back();
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Some keys (such as the arrow keys) prevent espanso from building
|
// Some keys (such as the arrow keys) and mouse clicks prevent espanso from building
|
||||||
// an accurate key buffer, so we need to invalidate it.
|
// an accurate key buffer, so we need to invalidate it.
|
||||||
if is_invalidating_key(&keyboard_event.key) {
|
if is_invalidating_event(&event.etype) {
|
||||||
trace!("invalidating event detected, clearing matching state");
|
trace!("invalidating event detected, clearing matching state");
|
||||||
matcher_states.clear();
|
matcher_states.clear();
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let mut all_results = Vec::new();
|
let mut all_results = Vec::new();
|
||||||
|
|
||||||
|
@ -158,8 +158,9 @@ fn convert_to_matcher_event(event_type: &EventType) -> Option<MatcherEvent> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_invalidating_key(key: &Key) -> bool {
|
fn is_invalidating_event(event_type: &EventType) -> bool {
|
||||||
match key {
|
match event_type {
|
||||||
|
EventType::Keyboard(keyboard_event) => match keyboard_event.key {
|
||||||
Key::ArrowDown => true,
|
Key::ArrowDown => true,
|
||||||
Key::ArrowLeft => true,
|
Key::ArrowLeft => true,
|
||||||
Key::ArrowRight => true,
|
Key::ArrowRight => true,
|
||||||
|
@ -170,6 +171,9 @@ fn is_invalidating_key(key: &Key) -> bool {
|
||||||
Key::PageUp => true,
|
Key::PageUp => true,
|
||||||
Key::Escape => true,
|
Key::Escape => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
},
|
||||||
|
EventType::Mouse(_) => true,
|
||||||
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user