Skip to content

Commit dd6af3d

Browse files
committed
fix(dictionary): had unsorted chunks after the previous chunk ended
Fixes #507
1 parent 305e801 commit dd6af3d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/rime/dict/dictionary.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,12 @@ bool DictEntryIterator::FindNextEntry() {
131131
if (++chunk.cursor >= chunk.size) {
132132
++chunk_index_;
133133
}
134-
else {
135-
// reorder chunks since the current chunk has got a new head element
136-
Sort();
134+
if (exhausted()) {
135+
return false;
137136
}
138-
return !exhausted();
137+
// reorder chunks to move the one with the best entry to head
138+
Sort();
139+
return true;
139140
}
140141

141142
bool DictEntryIterator::Next() {

0 commit comments

Comments
 (0)