diff --git a/espanso-match/src/rolling/matcher.rs b/espanso-match/src/rolling/matcher.rs index f4cae13..6e9526b 100644 --- a/espanso-match/src/rolling/matcher.rs +++ b/espanso-match/src/rolling/matcher.rs @@ -230,7 +230,12 @@ mod tests { } } - fn match_result_with_sep(id: Id, trigger: &str, left: Option<&str>, right: Option<&str>) -> MatchResult { + fn match_result_with_sep( + id: Id, + trigger: &str, + left: Option<&str>, + right: Option<&str>, + ) -> MatchResult { MatchResult { id, trigger: trigger.to_string(), @@ -321,7 +326,6 @@ mod tests { "arty", &StringMatchOptions { case_insensitive: true, - preserve_case_markers: true, ..Default::default() }, ), @@ -352,6 +356,9 @@ mod tests { get_matches_after_str("arTY", &matcher), vec![match_result(3, "arTY")] ); - assert_eq!(get_matches_after_str("ARTY", &matcher), vec![]); + assert_eq!( + get_matches_after_str("ARTY", &matcher), + vec![match_result(3, "ARTY")] + ); } } diff --git a/espanso-match/src/rolling/mod.rs b/espanso-match/src/rolling/mod.rs index b3b2636..57d60b7 100644 --- a/espanso-match/src/rolling/mod.rs +++ b/espanso-match/src/rolling/mod.rs @@ -49,15 +49,9 @@ impl RollingMatch { items.push(RollingItem::WordSeparator); } - for (index, c) in string.chars().enumerate() { + for c in string.chars() { if opt.case_insensitive { - // If preserve case markers is true, we want to keep the first two chars - // as case-sensitive. This is needed to implement the "propagate_case" option. - if opt.preserve_case_markers && index < 2 { - items.push(RollingItem::Char(c.to_string())) - } else { - items.push(RollingItem::CharInsensitive(c.to_string())) - } + items.push(RollingItem::CharInsensitive(c.to_string())) } else { items.push(RollingItem::Char(c.to_string())) } @@ -80,7 +74,6 @@ impl RollingMatch { pub struct StringMatchOptions { pub case_insensitive: bool, - pub preserve_case_markers: bool, pub left_word: bool, pub right_word: bool, } @@ -89,7 +82,6 @@ impl Default for StringMatchOptions { fn default() -> Self { Self { case_insensitive: false, - preserve_case_markers: false, left_word: false, right_word: false, } @@ -186,28 +178,4 @@ mod tests { } ) } - - #[test] - fn test_match_from_string_preserve_case_markers() { - assert_eq!( - RollingMatch::from_string( - 1, - "test", - &StringMatchOptions { - case_insensitive: true, - preserve_case_markers: true, - ..Default::default() - } - ), - RollingMatch { - id: 1, - items: vec![ - RollingItem::Char("t".to_string()), - RollingItem::Char("e".to_string()), - RollingItem::CharInsensitive("s".to_string()), - RollingItem::CharInsensitive("t".to_string()), - ] - } - ) - } }