mirror of
https://github.com/helix-editor/spellbook.git
synced 2025-10-06 00:02:48 +02:00
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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user