mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
handleBackspace should always send KEYCODE_DEL for InputType.TYPE_NULL
This is a fix only for the Bayo branch because this part in master has been changed. The corresponding fix in master is I295eeb5f9f0f1f07e919bf54122d003be150a174 bug: 11797053 Change-Id: I779be039ebf992de5d246c7a9d9509623fc3c120
This commit is contained in:
parent
b4cc0ae075
commit
87cd39124a
@ -2163,26 +2163,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
// later (typically, in a subsequent press on backspace).
|
||||
mLastSelectionEnd = mLastSelectionStart;
|
||||
mConnection.deleteSurroundingText(numCharsDeleted, 0);
|
||||
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
|
||||
ResearchLogger.latinIME_handleBackspace(numCharsDeleted,
|
||||
false /* shouldUncommitLogUnit */);
|
||||
}
|
||||
} else {
|
||||
// There is no selection, just delete one character.
|
||||
if (NOT_A_CURSOR_POSITION == mLastSelectionEnd) {
|
||||
// This should never happen.
|
||||
Log.e(TAG, "Backspace when we don't know the selection position");
|
||||
}
|
||||
final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor();
|
||||
if (codePointBeforeCursor == Constants.NOT_A_CODE) {
|
||||
// Nothing to delete before the cursor. We have to revert the deletion states
|
||||
// that were updated at the beginning of this method.
|
||||
mDeleteCount--;
|
||||
mExpectingUpdateSelection = false;
|
||||
return;
|
||||
}
|
||||
final int lengthToDelete =
|
||||
Character.isSupplementaryCodePoint(codePointBeforeCursor) ? 2 : 1;
|
||||
if (mAppWorkAroundsUtils.isBeforeJellyBean() ||
|
||||
currentSettings.mInputAttributes.isTypeNull()) {
|
||||
// There are two possible reasons to send a key event: either the field has
|
||||
@ -2193,23 +2179,28 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
// applications are relying on this behavior so we continue to support it for
|
||||
// older apps, so we retain this behavior if the app has target SDK < JellyBean.
|
||||
sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL);
|
||||
if (mDeleteCount > DELETE_ACCELERATE_AT) {
|
||||
sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL);
|
||||
}
|
||||
} else {
|
||||
final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor();
|
||||
if (codePointBeforeCursor == Constants.NOT_A_CODE) {
|
||||
// Nothing to delete before the cursor. We have to revert the deletion
|
||||
// states that were updated at the beginning of this method.
|
||||
mDeleteCount--;
|
||||
mExpectingUpdateSelection = false;
|
||||
return;
|
||||
}
|
||||
final int lengthToDelete =
|
||||
Character.isSupplementaryCodePoint(codePointBeforeCursor) ? 2 : 1;
|
||||
mConnection.deleteSurroundingText(lengthToDelete, 0);
|
||||
}
|
||||
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
|
||||
ResearchLogger.latinIME_handleBackspace(lengthToDelete,
|
||||
true /* shouldUncommitLogUnit */);
|
||||
}
|
||||
if (mDeleteCount > DELETE_ACCELERATE_AT) {
|
||||
final int codePointBeforeCursorToDeleteAgain =
|
||||
mConnection.getCodePointBeforeCursor();
|
||||
if (codePointBeforeCursorToDeleteAgain != Constants.NOT_A_CODE) {
|
||||
final int lengthToDeleteAgain = Character.isSupplementaryCodePoint(
|
||||
codePointBeforeCursorToDeleteAgain) ? 2 : 1;
|
||||
mConnection.deleteSurroundingText(lengthToDeleteAgain, 0);
|
||||
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
|
||||
ResearchLogger.latinIME_handleBackspace(lengthToDeleteAgain,
|
||||
true /* shouldUncommitLogUnit */);
|
||||
if (mDeleteCount > DELETE_ACCELERATE_AT) {
|
||||
final int codePointBeforeCursorToDeleteAgain =
|
||||
mConnection.getCodePointBeforeCursor();
|
||||
if (codePointBeforeCursorToDeleteAgain != Constants.NOT_A_CODE) {
|
||||
final int lengthToDeleteAgain = Character.isSupplementaryCodePoint(
|
||||
codePointBeforeCursorToDeleteAgain) ? 2 : 1;
|
||||
mConnection.deleteSurroundingText(lengthToDeleteAgain, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user