mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 15:02:48 +00:00
properly determine length of emojis when deleting
fixes issue described in https://github.com/Helium314/HeliBoard/issues/426#issuecomment-1944132643, but not the initial problem
This commit is contained in:
parent
fe5aa2c33c
commit
4b52f2d51d
5 changed files with 65 additions and 23 deletions
|
@ -1046,6 +1046,14 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
|||
return mCommittedTextBeforeComposingText.indexOf(" ") != -1;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public boolean hasLetterBeforeLastSpaceBeforeCursor() {
|
||||
return StringUtilsKt.hasLetterBeforeLastSpaceBeforeCursor(mCommittedTextBeforeComposingText);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue