(core) Fix autocomplete selection when options include emoji

Summary:
Searching for matching choices was using nativeCompare for a binary search,
while the list was sorted according to localeCompare. This was causing the
search to fail for some strings when the two orderings differ.

Test Plan: Tested manually

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3059
pull/115/head
Dmitry S 3 years ago
parent e1780e4f58
commit 43a62e7254

@ -163,7 +163,7 @@ export class ACIndexImpl<Item extends ACItem> implements ACIndex<Item> {
*/
private _findOverlaps(searchWord: string, searchWordPos: number): Map<number, number> {
const insertIndex = sortedIndex<{word: string}>(this._words, {word: searchWord},
(a, b) => nativeCompare(a.word, b.word));
(a, b) => localeCompare(a.word, b.word));
// Maps index of item to its score.
const scored = new Map<number, number>();

Loading…
Cancel
Save