diff --git a/matcher/src/pattern.rs b/matcher/src/pattern.rs index 0c554ba..e8ecdfa 100644 --- a/matcher/src/pattern.rs +++ b/matcher/src/pattern.rs @@ -171,8 +171,8 @@ impl Atom { let mut saw_backslash = false; for mut c in chars::graphemes(needle) { if saw_backslash { - if c == ' ' { - needle_.push(' '); + if c.is_whitespace() { + needle_.push(c); saw_backslash = false; continue; } else { diff --git a/matcher/src/pattern/tests.rs b/matcher/src/pattern/tests.rs index 88880ba..78a5fe0 100644 --- a/matcher/src/pattern/tests.rs +++ b/matcher/src/pattern/tests.rs @@ -87,6 +87,9 @@ fn case_matching() { fn escape() { let pat = Atom::parse("foo\\ bar", CaseMatching::Smart, Normalization::Smart); assert_eq!(pat.needle.to_string(), "foo bar"); + // escaped double-width IDEOGRAPHIC SPACE + let pat = Atom::parse("foo\\  bar", CaseMatching::Smart, Normalization::Smart); + assert_eq!(pat.needle.to_string(), "foo bar"); let pat = Atom::parse("\\!foo", CaseMatching::Smart, Normalization::Smart); assert_eq!(pat.needle.to_string(), "!foo"); assert_eq!(pat.kind, AtomKind::Fuzzy);