remove old workaround where issue isn't mentioned in linked documentation any more

This commit is contained in:
Helium314 2024-01-05 18:14:44 +01:00
parent 615d1711b5
commit 73561e0e70
2 changed files with 8 additions and 25 deletions

View file

@ -289,6 +289,10 @@ public final class RichInputConnection implements PrivateCommandPerformer {
} }
} }
public void commitCodePoint(final int codePoint) {
commitText(StringUtils.newSingleCodePointString(codePoint), 1);
}
/** /**
* Calls {@link InputConnection#commitText(CharSequence, int)}. * Calls {@link InputConnection#commitText(CharSequence, int)}.
* *

View file

@ -973,7 +973,7 @@ public final class InputLogic {
if (swapWeakSpace && trySwapSwapperAndSpace(event, inputTransaction)) { if (swapWeakSpace && trySwapSwapperAndSpace(event, inputTransaction)) {
mSpaceState = SpaceState.WEAK; mSpaceState = SpaceState.WEAK;
} else { } else {
sendKeyCodePoint(settingsValues, codePoint); mConnection.commitCodePoint(codePoint);
} }
} }
inputTransaction.setRequiresUpdateSuggestions(); inputTransaction.setRequiresUpdateSuggestions();
@ -1055,7 +1055,7 @@ public final class InputLogic {
} }
if (!shouldAvoidSendingCode) { if (!shouldAvoidSendingCode) {
sendKeyCodePoint(settingsValues, codePoint); mConnection.commitCodePoint(codePoint);
} }
} else { } else {
if ((SpaceState.PHANTOM == inputTransaction.getMSpaceState() if ((SpaceState.PHANTOM == inputTransaction.getMSpaceState()
@ -1086,7 +1086,7 @@ public final class InputLogic {
mSpaceState = SpaceState.PHANTOM; mSpaceState = SpaceState.PHANTOM;
} }
sendKeyCodePoint(settingsValues, codePoint); mConnection.commitCodePoint(codePoint);
// Set punctuation right away. onUpdateSelection will fire but tests whether it is // Set punctuation right away. onUpdateSelection will fire but tests whether it is
// already displayed or not, so it's okay. // already displayed or not, so it's okay.
@ -2098,27 +2098,6 @@ public final class InputLogic {
KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE)); KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE));
} }
/**
* Sends a code point to the editor, using the most appropriate method.
*
* Normally we send code points with commitText, but there are some cases (where backward
* compatibility is a concern for example) where we want to use deprecated methods.
*
* @param settingsValues the current values of the settings.
* @param codePoint the code point to send.
*/
// TODO: replace these two parameters with an InputTransaction
private void sendKeyCodePoint(final SettingsValues settingsValues, final int codePoint) {
// TODO: Remove this special handling of digit letters.
// For backward compatibility. See {@link InputMethodService#sendKeyChar(char)}.
if (codePoint >= '0' && codePoint <= '9') {
sendDownUpKeyEvent(codePoint - '0' + KeyEvent.KEYCODE_0);
return;
}
mConnection.commitText(StringUtils.newSingleCodePointString(codePoint), 1);
}
/** /**
* Insert an automatic space, if the options allow it. * Insert an automatic space, if the options allow it.
* *
@ -2134,7 +2113,7 @@ public final class InputLogic {
&& !mConnection.textBeforeCursorLooksLikeURL() // adding this check to textBeforeCursorMayBeUrlOrSimilar might not be wanted for word continuation (see effect on unit tests) && !mConnection.textBeforeCursorLooksLikeURL() // adding this check to textBeforeCursorMayBeUrlOrSimilar might not be wanted for word continuation (see effect on unit tests)
&& !(mConnection.getCodePointBeforeCursor() == Constants.CODE_PERIOD && mConnection.wordBeforeCursorMayBeEmail()) && !(mConnection.getCodePointBeforeCursor() == Constants.CODE_PERIOD && mConnection.wordBeforeCursorMayBeEmail())
) { ) {
sendKeyCodePoint(settingsValues, Constants.CODE_SPACE); mConnection.commitCodePoint(Constants.CODE_SPACE);
} }
} }