diff --git a/espanso-engine/src/funnel/default.rs b/espanso-engine/src/funnel/default.rs index d409bc5..cd32179 100644 --- a/espanso-engine/src/funnel/default.rs +++ b/espanso-engine/src/funnel/default.rs @@ -48,7 +48,10 @@ impl<'a> Funnel for DefaultFunnel<'a> { .expect("invalid source index returned by select operation"); // Receive (and convert) the event - let event = source.receive(op); - FunnelResult::Event(event) + if let Some(event) = source.receive(op) { + FunnelResult::Event(event) + } else { + FunnelResult::Skipped + } } } diff --git a/espanso-engine/src/funnel/mod.rs b/espanso-engine/src/funnel/mod.rs index d920310..5c2abbb 100644 --- a/espanso-engine/src/funnel/mod.rs +++ b/espanso-engine/src/funnel/mod.rs @@ -27,7 +27,7 @@ mod default; pub trait Source<'a> { fn register(&'a self, select: &mut Select<'a>) -> usize; - fn receive(&'a self, op: SelectedOperation) -> Event; + fn receive(&'a self, op: SelectedOperation) -> Option; } pub trait Funnel { @@ -36,6 +36,7 @@ pub trait Funnel { pub enum FunnelResult { Event(Event), + Skipped, EndOfStream, } diff --git a/espanso-engine/src/lib.rs b/espanso-engine/src/lib.rs index eb4fbd4..3ac31c8 100644 --- a/espanso-engine/src/lib.rs +++ b/espanso-engine/src/lib.rs @@ -68,6 +68,9 @@ impl<'a> Engine<'a> { debug!("end of stream received"); return ExitMode::Exit; } + FunnelResult::Skipped => { + // This event has been skipped, no need to handle it + } } } }