diff --git a/src/matcher/mod.rs b/src/matcher/mod.rs index a8f0ffa..1c8916b 100644 --- a/src/matcher/mod.rs +++ b/src/matcher/mod.rs @@ -32,6 +32,7 @@ pub struct Match { pub trigger: String, pub content: MatchContentType, pub word: bool, + pub passive_only: bool, // Automatically calculated from the trigger, used by the matcher to check for correspondences. #[serde(skip_serializing)] @@ -133,7 +134,8 @@ impl<'a> From<&'a AutoMatch> for Match{ Self { trigger: other.trigger.clone(), content, - word: other.word.clone(), + word: other.word, + passive_only: other.passive_only, _trigger_sequence: trigger_sequence, } } @@ -155,10 +157,14 @@ struct AutoMatch { #[serde(default = "default_word")] pub word: bool, + + #[serde(default = "default_passive_only")] + pub passive_only: bool, } fn default_vars() -> Vec {Vec::new()} fn default_word() -> bool {false} +fn default_passive_only() -> bool {false} fn default_replace() -> Option {None} fn default_image_path() -> Option {None} diff --git a/src/matcher/scrolling.rs b/src/matcher/scrolling.rs index 9c70fcd..ce1f951 100644 --- a/src/matcher/scrolling.rs +++ b/src/matcher/scrolling.rs @@ -114,6 +114,11 @@ impl <'a, R: MatchReceiver, M: ConfigManager<'a>> super::Matcher for ScrollingMa let new_matches: Vec = active_config.matches.iter() .filter(|&x| { + // only active-enabled matches are considered + if x.passive_only { + return false; + } + let mut result = Self::is_matching(x, c, 0, is_current_word_separator); if x.word {