diff --git a/crates/render/src/text/search.rs b/crates/render/src/text/search.rs index 54b02027e3..a52cf5251c 100644 --- a/crates/render/src/text/search.rs +++ b/crates/render/src/text/search.rs @@ -199,7 +199,14 @@ fn characters(page: &PageText, texts: &[String], divided: &[bool], reading: Hyph /// Non-overlapping hits of `needle` (with its KMP `prefix` table) in `chars`, as glyph ranges. /// `zero_width_space` says which characters come right after a skipped zero width space. -fn search(chars: &[(char, usize)], zero_width_space: &[bool], needle: &[char], prefix: &[usize], whole_words: bool, limit: usize) -> Vec> { +fn search( + chars: &[(char, usize)], + zero_width_space: &[bool], + needle: &[char], + prefix: &[usize], + whole_words: bool, + limit: usize, +) -> Vec> { if needle.len() > chars.len() { return Vec::new(); } diff --git a/crates/render/tests/it/search.rs b/crates/render/tests/it/search.rs index f1eeb0b8ed..0029d88b72 100644 --- a/crates/render/tests/it/search.rs +++ b/crates/render/tests/it/search.rs @@ -202,8 +202,9 @@ fn whole_word_rejection_keeps_overlapping_candidates() { #[test] fn search_matches_reference_for_unicode_gaps_limits_and_word_boundaries() { - let alphabet = - ["a", "b", " ", "-", "İ", "ı", "ς", "Σ", "\t", "\n", "ffi", "", "界", "e\u{301}", "العربية", "\u{FB01}", "b\u{AD}", "1", "\u{AD}", "a\u{200B}", "\u{2010}"]; + let alphabet = ["a", "b", " ", "-", "İ", "ı", "ς", "Σ", "\t", "\n", "ffi", "", "界", "e\u{301}", "العربية", "\u{AD}", "a\u{200B}"]; + // Ligatures, digits and HYPHEN exercise the readings of a line-end hyphen. + let alphabet: Vec<&str> = alphabet.into_iter().chain(["\u{FB01}", "1", "\u{2010}"]).collect(); let mut seed = 1234567u64; let mut next = || { seed = seed.wrapping_mul(6364136223846793005).wrapping_add(1);