improve emoji detection when deleting

still has issues with hand + skin tone emojis
This commit is contained in:
Helium314 2024-06-12 23:54:23 +02:00
parent d91350524a
commit 6a34f2c832
3 changed files with 10 additions and 6 deletions

View file

@ -1311,7 +1311,7 @@ public final class InputLogic {
// TODO: Add a new StatsUtils method onBackspaceWhenNoText()
return;
}
final int lengthToDelete = Character.isSupplementaryCodePoint(codePointBeforeCursor)
final int lengthToDelete = codePointBeforeCursor > 0xFE00
? mConnection.getCharCountToDeleteBeforeCursor() : 1;
mConnection.deleteTextBeforeCursor(lengthToDelete);
int totalDeletedLength = lengthToDelete;
@ -1324,7 +1324,7 @@ public final class InputLogic {
final int codePointBeforeCursorToDeleteAgain =
mConnection.getCodePointBeforeCursor();
if (codePointBeforeCursorToDeleteAgain != Constants.NOT_A_CODE) {
final int lengthToDeleteAgain = Character.isSupplementaryCodePoint(codePointBeforeCursorToDeleteAgain)
final int lengthToDeleteAgain = codePointBeforeCursor > 0xFE00
? mConnection.getCharCountToDeleteBeforeCursor() : 1;
mConnection.deleteTextBeforeCursor(lengthToDeleteAgain);
totalDeletedLength += lengthToDeleteAgain;