suggester: Make index into hypenated words absolute

This fixes suggest_breakdefault hanging. (Because it kept breaking the
word the same way over and over again.)
This commit is contained in:
Michael Davis
2024-11-09 14:01:10 -05:00
parent e282b05c55
commit d23a934446

View File

@@ -182,9 +182,9 @@ impl<'a, S: BuildHasher> Suggester<'a, S> {
let mut suggestions_tmp = Vec::new();
let mut i = 0;
loop {
let j = word[i..].find('-');
let j = word[i..].find('-').map(|idx| idx + i);
let part = match j {
Some(j) => &word[i..i + j],
Some(j) => &word[i..j],
None => &word[i..],
};
if !self.checker.check(part) {