style(engine): fix formatting
This commit is contained in:
parent
d11af8b1c2
commit
8fe508bf93
|
@ -96,4 +96,4 @@ pub struct UndoEvent {
|
|||
pub match_id: i32,
|
||||
pub trigger: String,
|
||||
pub replace: String,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
use log::trace;
|
||||
|
||||
use super::{DisableOptions, EnabledStatusProvider, MatchFilter, MatchInfoProvider, MatchProvider, MatchSelector, Matcher, MatcherMiddlewareConfigProvider, Middleware, Multiplexer, PathProvider, Processor, Renderer, UndoEnabledProvider, middleware::{
|
||||
use super::{
|
||||
middleware::{
|
||||
action::{ActionMiddleware, EventSequenceProvider},
|
||||
cause::CauseCompensateMiddleware,
|
||||
cursor_hint::CursorHintMiddleware,
|
||||
|
@ -30,8 +31,20 @@ use super::{DisableOptions, EnabledStatusProvider, MatchFilter, MatchInfoProvide
|
|||
multiplex::MultiplexMiddleware,
|
||||
past_discard::PastEventsDiscardMiddleware,
|
||||
render::RenderMiddleware,
|
||||
}};
|
||||
use crate::{event::{Event, EventType}, process::middleware::{context_menu::ContextMenuMiddleware, disable::DisableMiddleware, exit::ExitMiddleware, hotkey::HotKeyMiddleware, icon_status::IconStatusMiddleware, image_resolve::ImageResolverMiddleware, search::SearchMiddleware, suppress::SuppressMiddleware, undo::UndoMiddleware}};
|
||||
},
|
||||
DisableOptions, EnabledStatusProvider, MatchFilter, MatchInfoProvider, MatchProvider,
|
||||
MatchSelector, Matcher, MatcherMiddlewareConfigProvider, Middleware, Multiplexer, PathProvider,
|
||||
Processor, Renderer, UndoEnabledProvider,
|
||||
};
|
||||
use crate::{
|
||||
event::{Event, EventType},
|
||||
process::middleware::{
|
||||
context_menu::ContextMenuMiddleware, disable::DisableMiddleware, exit::ExitMiddleware,
|
||||
hotkey::HotKeyMiddleware, icon_status::IconStatusMiddleware,
|
||||
image_resolve::ImageResolverMiddleware, search::SearchMiddleware, suppress::SuppressMiddleware,
|
||||
undo::UndoMiddleware,
|
||||
},
|
||||
};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct DefaultProcessor<'a> {
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
*/
|
||||
|
||||
use super::super::Middleware;
|
||||
use crate::{event::{Event, EventType, effect::TriggerCompensationEvent, internal::CauseCompensatedMatchEvent}};
|
||||
use crate::event::{
|
||||
effect::TriggerCompensationEvent, internal::CauseCompensatedMatchEvent, Event, EventType,
|
||||
};
|
||||
|
||||
pub struct CauseCompensateMiddleware {}
|
||||
|
||||
|
@ -35,17 +37,24 @@ impl Middleware for CauseCompensateMiddleware {
|
|||
|
||||
fn next(&self, event: Event, dispatch: &mut dyn FnMut(Event)) -> Event {
|
||||
if let EventType::MatchSelected(m_event) = &event.etype {
|
||||
let compensated_event =
|
||||
Event::caused_by(event.source_id, EventType::CauseCompensatedMatch(CauseCompensatedMatchEvent { m: m_event.chosen.clone() }));
|
||||
let compensated_event = Event::caused_by(
|
||||
event.source_id,
|
||||
EventType::CauseCompensatedMatch(CauseCompensatedMatchEvent {
|
||||
m: m_event.chosen.clone(),
|
||||
}),
|
||||
);
|
||||
|
||||
if let Some(trigger) = &m_event.chosen.trigger {
|
||||
dispatch(compensated_event);
|
||||
|
||||
// Before the event, place a trigger compensation
|
||||
return Event::caused_by(event.source_id, EventType::TriggerCompensation(TriggerCompensationEvent {
|
||||
trigger: trigger.clone(),
|
||||
left_separator: m_event.chosen.left_separator.clone(),
|
||||
}));
|
||||
return Event::caused_by(
|
||||
event.source_id,
|
||||
EventType::TriggerCompensation(TriggerCompensationEvent {
|
||||
trigger: trigger.clone(),
|
||||
left_separator: m_event.chosen.left_separator.clone(),
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
return compensated_event;
|
||||
}
|
||||
|
|
|
@ -51,4 +51,4 @@ impl<'a> Middleware for SuppressMiddleware<'a> {
|
|||
|
||||
event
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user