Skip to content

Commit

Permalink
fix(dictionary): had unsorted chunks after the previous chunk ended
Browse files Browse the repository at this point in the history
Fixes #507
  • Loading branch information
lotem committed Nov 28, 2021
1 parent 305e801 commit dd6af3d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/rime/dict/dictionary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ bool DictEntryIterator::FindNextEntry() {
if (++chunk.cursor >= chunk.size) {
++chunk_index_;
}
else {
// reorder chunks since the current chunk has got a new head element
Sort();
if (exhausted()) {
return false;
}
return !exhausted();
// reorder chunks to move the one with the best entry to head
Sort();
return true;
}

bool DictEntryIterator::Next() {
Expand Down

0 comments on commit dd6af3d

Please sign in to comment.