From 43a62e7254174dd26b74adae10437bba3a99e170 Mon Sep 17 00:00:00 2001 From: Dmitry S Date: Mon, 4 Oct 2021 18:52:03 -0400 Subject: [PATCH] (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 --- app/client/lib/ACIndex.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/lib/ACIndex.ts b/app/client/lib/ACIndex.ts index a67e1e49..c3f638b4 100644 --- a/app/client/lib/ACIndex.ts +++ b/app/client/lib/ACIndex.ts @@ -163,7 +163,7 @@ export class ACIndexImpl implements ACIndex { */ private _findOverlaps(searchWord: string, searchWordPos: number): Map { 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();