fix issue when trying to paste text while cursor is in a word

This commit is contained in:
Helium314 2024-05-26 19:15:57 +02:00
parent 6c2a3e8b5f
commit af3d0535b2

View file

@ -228,8 +228,14 @@ public final class InputLogic {
getActualCapsMode(settingsValues, keyboardShiftMode));
mConnection.beginBatchEdit();
if (mWordComposer.isComposingWord()) {
commitCurrentAutoCorrection(settingsValues, rawText, handler);
addToHistoryIfEmoji(rawText, settingsValues); // add emoji after committing text
if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
// stop composing, otherwise the text will end up at the end of the current word
mConnection.finishComposingText();
resetComposingState(false);
} else {
commitCurrentAutoCorrection(settingsValues, rawText, handler);
addToHistoryIfEmoji(rawText, settingsValues); // add emoji after committing text
}
} else {
addToHistoryIfEmoji(rawText, settingsValues); // add emoji before resetting, otherwise lastComposedWord is empty
resetComposingState(true /* alsoResetLastComposedWord */);