am 16d1e77a: Merge "handleBackspace should always send KEYCODE_DEL for InputType.TYPE_NULL"

* commit '16d1e77a16f70665afa2fe4b1a3a711b3a7d4409':
  handleBackspace should always send KEYCODE_DEL for InputType.TYPE_NULL
main
Ken Wakasa 2013-11-21 23:30:48 -08:00 committed by Android Git Automerger
commit e7656157e7
1 changed files with 25 additions and 22 deletions

View File

@ -2152,13 +2152,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// This should never happen. // This should never happen.
Log.e(TAG, "Backspace when we don't know the selection position"); 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.
return;
}
final int lengthToDelete =
Character.isSupplementaryCodePoint(codePointBeforeCursor) ? 2 : 1;
if (mAppWorkAroundsUtils.isBeforeJellyBean() || if (mAppWorkAroundsUtils.isBeforeJellyBean() ||
currentSettings.mInputAttributes.isTypeNull()) { currentSettings.mInputAttributes.isTypeNull()) {
// There are two possible reasons to send a key event: either the field has // There are two possible reasons to send a key event: either the field has
@ -2169,9 +2162,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// applications are relying on this behavior so we continue to support it for // 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. // older apps, so we retain this behavior if the app has target SDK < JellyBean.
sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL); sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL);
} else { if (mDeleteCount > DELETE_ACCELERATE_AT) {
mConnection.deleteSurroundingText(lengthToDelete, 0); sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL);
} }
} else {
final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor();
if (codePointBeforeCursor == Constants.NOT_A_CODE) {
// Nothing to delete before the cursor.
return;
}
final int lengthToDelete =
Character.isSupplementaryCodePoint(codePointBeforeCursor) ? 2 : 1;
mConnection.deleteSurroundingText(lengthToDelete, 0);
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_handleBackspace(lengthToDelete, ResearchLogger.latinIME_handleBackspace(lengthToDelete,
true /* shouldUncommitLogUnit */); true /* shouldUncommitLogUnit */);
@ -2190,6 +2192,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
} }
} }
}
if (currentSettings.isSuggestionsRequested(mDisplayOrientation) if (currentSettings.isSuggestionsRequested(mDisplayOrientation)
&& currentSettings.mCurrentLanguageHasSpaces) { && currentSettings.mCurrentLanguageHasSpaces) {
restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(); restartSuggestionsOnWordBeforeCursorIfAtEndOfWord();