mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 15:02:48 +00:00
improve emoji detection when deleting
still has issues with hand + skin tone emojis
This commit is contained in:
parent
d91350524a
commit
6a34f2c832
3 changed files with 10 additions and 6 deletions
|
@ -1072,10 +1072,12 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
|||
|
||||
public int getCharCountToDeleteBeforeCursor() {
|
||||
final int lastCodePoint = getCodePointBeforeCursor();
|
||||
if (!Character.isSupplementaryCodePoint(lastCodePoint)) return 1;
|
||||
if (!StringUtils.mightBeEmoji(lastCodePoint)) return 2;
|
||||
final String text = mCommittedTextBeforeComposingText.toString() + mComposingText;
|
||||
return StringUtilsKt.getFullEmojiAtEnd(text).length();
|
||||
if (StringUtils.mightBeEmoji(lastCodePoint)) {
|
||||
final String text = mCommittedTextBeforeComposingText.toString() + mComposingText;
|
||||
final int emojiLength = StringUtilsKt.getFullEmojiAtEnd(text).length();
|
||||
if (emojiLength > 0) return emojiLength;
|
||||
}
|
||||
return Character.isSupplementaryCodePoint(lastCodePoint) ? 2 : 1;
|
||||
}
|
||||
|
||||
public boolean hasLetterBeforeLastSpaceBeforeCursor() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue