Bluesky app fork with some witchin' additions 💫

fix some auto complete issues

+8 -5
+2
__tests__/lib/strings/mention-manip.test.ts
··· 32 32 ['@alice hello', 7, undefined], 33 33 ['alice@alice', 0, undefined], 34 34 ['alice@alice', 6, undefined], 35 + ['hello @alice-com goodbye', 8, 'alice-com'], 35 36 ] 36 37 37 38 it.each(cases)( ··· 72 73 ['@alice hello', 7, '@alice hello'], 73 74 ['alice@alice', 0, 'alice@alice'], 74 75 ['alice@alice', 6, 'alice@alice'], 76 + ['hello @alice-com goodbye', 10, 'hello @alice.com goodbye'], 75 77 ] 76 78 77 79 it.each(cases)(
+1 -1
src/lib/strings/mention-manip.ts
··· 7 7 text: string, 8 8 cursorPos: number, 9 9 ): FoundMention | undefined { 10 - let re = /(^|\s)@([a-z0-9.]*)/gi 10 + let re = /(^|\s)@([a-z0-9.-]*)/gi 11 11 let match 12 12 while ((match = re.exec(text))) { 13 13 const spaceOffset = match[1].length
+5 -4
src/view/com/composer/text-input/TextInput.tsx
··· 96 96 newRt.detectFacetsWithoutResolution() 97 97 setRichText(newRt) 98 98 99 - const prefix = getMentionAt( 100 - newText, 101 - textInputSelection.current?.start || 0, 102 - ) 99 + // NOTE: BinaryFiddler 100 + // onChangeText happens before onSelectionChange, cursorPos is out of bound if the user deletes characters, 101 + const cursorPos = textInputSelection.current?.start ?? 0 102 + const prefix = getMentionAt(newText, Math.min(cursorPos, newText.length)) 103 + 103 104 if (prefix) { 104 105 setAutocompletePrefix(prefix.value) 105 106 } else if (autocompletePrefix) {