fix(core): improve continuous word matches detection
This commit is contained in:
parent
04f1449046
commit
82096ad9fa
|
@ -40,6 +40,7 @@ pub enum Event {
|
||||||
|
|
||||||
RenderingRequested(render::RenderingRequestedEvent),
|
RenderingRequested(render::RenderingRequestedEvent),
|
||||||
Rendered(render::RenderedEvent),
|
Rendered(render::RenderedEvent),
|
||||||
|
MatchInjected,
|
||||||
|
|
||||||
// Effects
|
// Effects
|
||||||
TriggerCompensation(effect::TriggerCompensationEvent),
|
TriggerCompensation(effect::TriggerCompensationEvent),
|
||||||
|
|
|
@ -50,10 +50,14 @@ impl<'a> Middleware for ActionMiddleware<'a> {
|
||||||
|
|
||||||
fn next(&self, event: Event, dispatch: &mut dyn FnMut(Event)) -> Event {
|
fn next(&self, event: Event, dispatch: &mut dyn FnMut(Event)) -> Event {
|
||||||
match &event {
|
match &event {
|
||||||
Event::Rendered(m_event) => Event::TextInject(TextInjectRequest {
|
Event::Rendered(m_event) => {
|
||||||
text: m_event.body.clone(),
|
dispatch(Event::MatchInjected);
|
||||||
force_mode: self.match_info_provider.get_force_mode(m_event.match_id),
|
|
||||||
}),
|
Event::TextInject(TextInjectRequest {
|
||||||
|
text: m_event.body.clone(),
|
||||||
|
force_mode: self.match_info_provider.get_force_mode(m_event.match_id),
|
||||||
|
})
|
||||||
|
}
|
||||||
Event::CursorHintCompensation(m_event) => {
|
Event::CursorHintCompensation(m_event) => {
|
||||||
Event::KeySequenceInject(KeySequenceInjectRequest {
|
Event::KeySequenceInject(KeySequenceInjectRequest {
|
||||||
keys: (0..m_event.cursor_hint_back_count)
|
keys: (0..m_event.cursor_hint_back_count)
|
||||||
|
|
|
@ -120,28 +120,24 @@ impl<'a, State> Middleware for MatcherMiddleware<'a, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_event_of_interest(event: &Event) -> bool {
|
fn is_event_of_interest(event: &Event) -> bool {
|
||||||
if let Event::Keyboard(keyboard_event) = &event {
|
match event {
|
||||||
if keyboard_event.status == Status::Pressed {
|
Event::Keyboard(keyboard_event) if keyboard_event.status == Status::Pressed => true,
|
||||||
return true;
|
// TODO: handle mouse
|
||||||
}
|
Event::MatchInjected => true,
|
||||||
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: handle mouse
|
|
||||||
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_to_matcher_event(event: &Event) -> Option<MatcherEvent> {
|
fn convert_to_matcher_event(event: &Event) -> Option<MatcherEvent> {
|
||||||
if let Event::Keyboard(keyboard_event) = event {
|
match event {
|
||||||
return Some(MatcherEvent::Key {
|
Event::Keyboard(keyboard_event) => Some(MatcherEvent::Key {
|
||||||
key: keyboard_event.key.clone(),
|
key: keyboard_event.key.clone(),
|
||||||
chars: keyboard_event.value.clone(),
|
chars: keyboard_event.value.clone(),
|
||||||
});
|
}),
|
||||||
|
Event::MatchInjected => Some(MatcherEvent::VirtualSeparator),
|
||||||
|
// TODO: mouse event should act as separator
|
||||||
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: mouse event should act as separator
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_invalidating_key(key: &Key) -> bool {
|
fn is_invalidating_key(key: &Key) -> bool {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user