Fix highlight by replacing num_graphemes_from_bytes

num_graphemes_from_bytes has been renamed in the tokenizer to
num_chars_from_bytes.

Highlight now works correctly!
This commit is contained in:
Samyak S Sarnayak 2022-01-17 13:02:55 +05:30
parent c10f58b7bd
commit 5ab505be33
No known key found for this signature in database
GPG Key ID: 365873F2F0C6153B

View File

@ -40,11 +40,11 @@ impl MatchingWords {
Distance::Exact(t) if t <= *typo => { Distance::Exact(t) if t <= *typo => {
if *is_prefix { if *is_prefix {
let len = bytes_to_highlight(word_to_highlight.text(), query_word); let len = bytes_to_highlight(word_to_highlight.text(), query_word);
Some(word_to_highlight.num_graphemes_from_bytes(len)) Some(word_to_highlight.num_chars_from_bytes(len))
} else { } else {
Some( Some(
word_to_highlight word_to_highlight
.num_graphemes_from_bytes(word_to_highlight.text().len()), .num_chars_from_bytes(word_to_highlight.text().len()),
) )
} }
} }