From 2eef404d6c9b135c472b853bda18d23651822060 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Tue, 11 May 2021 21:14:53 +0200 Subject: [PATCH] fix(core): fix bug that skipped propagate_case check --- espanso/src/cli/worker/engine/render/mod.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/espanso/src/cli/worker/engine/render/mod.rs b/espanso/src/cli/worker/engine/render/mod.rs index 86b8b03..c93e2d9 100644 --- a/espanso/src/cli/worker/engine/render/mod.rs +++ b/espanso/src/cli/worker/engine/render/mod.rs @@ -202,10 +202,13 @@ impl<'a> Renderer<'a> for RendererAdapter<'a> { .or_insert_with(|| generate_context(&match_set, &self.template_map, &self.global_vars_map)); let raw_match = self.match_provider.get(match_id); + let propagate_case = raw_match.map(is_propagate_case).unwrap_or(false); let preferred_uppercasing_style = raw_match.and_then(extract_uppercasing_style); let options = RenderOptions { - casing_style: if let Some(trigger) = trigger { + casing_style: if !propagate_case { + CasingStyle::None + } else if let Some(trigger) = trigger { calculate_casing_style(trigger, preferred_uppercasing_style) } else { CasingStyle::None @@ -254,6 +257,14 @@ fn extract_uppercasing_style(m: &Match) -> Option { } } +fn is_propagate_case(m: &Match) -> bool { + if let MatchCause::Trigger(cause) = &m.cause { + cause.propagate_case + } else { + false + } +} + // TODO: test fn calculate_casing_style( trigger: &str,