···77 text: string,
88 cursorPos: number,
99): FoundMention | undefined {
1010- let re = /(^|\s)@([a-z0-9.]*)/gi
1010+ let re = /(^|\s)@([a-z0-9.-]*)/gi
1111 let match
1212 while ((match = re.exec(text))) {
1313 const spaceOffset = match[1].length
+5-4
src/view/com/composer/text-input/TextInput.tsx
···9696 newRt.detectFacetsWithoutResolution()
9797 setRichText(newRt)
98989999- const prefix = getMentionAt(
100100- newText,
101101- textInputSelection.current?.start || 0,
102102- )
9999+ // NOTE: BinaryFiddler
100100+ // onChangeText happens before onSelectionChange, cursorPos is out of bound if the user deletes characters,
101101+ const cursorPos = textInputSelection.current?.start ?? 0
102102+ const prefix = getMentionAt(newText, Math.min(cursorPos, newText.length))
103103+103104 if (prefix) {
104105 setAutocompletePrefix(prefix.value)
105106 } else if (autocompletePrefix) {