diff --git a/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java b/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java index 4b0dcf947..77cc943f2 100644 --- a/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java +++ b/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java @@ -1399,14 +1399,21 @@ public class LatinIMELegacy implements KeyboardActionListener, mInputLogic.mConnection.setSelection(start, end); } else { for (; steps < 0; steps++) - mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL, 0); + onCodeInput( + Constants.CODE_DELETE, + Constants.NOT_A_COORDINATE, + Constants.NOT_A_COORDINATE, false); } } @Override public void onUpWithDeletePointerActive() { - if (mInputLogic.mConnection.hasSelection()) - mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL, 0); + if (mInputLogic.mConnection.hasSelection()) { + onCodeInput( + Constants.CODE_DELETE, + Constants.NOT_A_COORDINATE, + Constants.NOT_A_COORDINATE, false); + } } @Override diff --git a/java/src/org/futo/inputmethod/latin/inputlogic/InputLogic.java b/java/src/org/futo/inputmethod/latin/inputlogic/InputLogic.java index ded932fa3..b31582cab 100644 --- a/java/src/org/futo/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/org/futo/inputmethod/latin/inputlogic/InputLogic.java @@ -2429,6 +2429,9 @@ public final class InputLogic { end = cursor; } + start = Math.max(0, start); + end = Math.max(0, end); + mConnection.setSelection(start, end); } diff --git a/java/src/org/futo/inputmethod/latin/uix/EmojiTracker.kt b/java/src/org/futo/inputmethod/latin/uix/EmojiTracker.kt index 4a6575248..b4d6eaaf0 100644 --- a/java/src/org/futo/inputmethod/latin/uix/EmojiTracker.kt +++ b/java/src/org/futo/inputmethod/latin/uix/EmojiTracker.kt @@ -22,6 +22,14 @@ object EmojiTracker { } } + suspend fun Context.unuseEmoji(emoji: String) { + dataStore.edit { + val split = (it[lastUsedEmoji] ?: "").split("<|>") + val idxToRemove = split.indexOfFirst { v -> v == emoji } + it[lastUsedEmoji] = split.filterIndexed { i, _ -> i != idxToRemove}.joinToString("<|>") + } + } + suspend fun Context.getRecentEmojis(): List { return getSetting(lastUsedEmoji, "") .split("<|>")