Skip to content

Commit e293edb

Browse files
authored
fix: normalize Unicode characters in paste modal for proper detection (#976)
1 parent b074462 commit e293edb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ui/src/components/popovers/PasteModal.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ export default function PasteModal() {
6666
const macroSteps: MacroStep[] = [];
6767

6868
for (const char of text) {
69-
const keyprops = selectedKeyboard.chars[char];
69+
const normalizedChar = char.normalize('NFC');
70+
const keyprops = selectedKeyboard.chars[normalizedChar];
7071
if (!keyprops) continue;
7172

7273
const { key, shift, altRight, deadKey, accentKey } = keyprops;
@@ -164,7 +165,7 @@ export default function PasteModal() {
164165
...new Set(
165166
// @ts-expect-error TS doesn't recognize Intl.Segmenter in some environments
166167
[...new Intl.Segmenter().segment(value)]
167-
.map(x => x.segment)
168+
.map(x => x.segment.normalize('NFC'))
168169
.filter(char => !selectedKeyboard.chars[char]),
169170
),
170171
];

0 commit comments

Comments
 (0)