am 37105e86: am 09c4909c: Merge "Remove a high surrogate after a delete if any" into jb-dev

* commit '37105e8636fc84f9e903581443730a0bf6692996':
  Remove a high surrogate after a delete if any
This commit is contained in:
Jean Chalard 2012-05-22 03:38:05 -07:00 committed by Android Git Automerger
commit 906857430b

View file

@ -2300,6 +2300,19 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
break;
}
}
if (Keyboard.CODE_DELETE == primaryCode) {
// This is a stopgap solution to avoid leaving a high surrogate alone in a text view.
// In the future, we need to deprecate deteleSurroundingText() and have a surrogate
// pair-friendly way of deleting characters in InputConnection.
final InputConnection ic = getCurrentInputConnection();
if (null != ic) {
final CharSequence lastChar = ic.getTextBeforeCursor(1, 0);
if (lastChar.length() > 0 && Character.isHighSurrogate(lastChar.charAt(0))) {
ic.deleteSurroundingText(1, 0);
}
}
}
}
// receive ringer mode change and network state change.