Remove a high surrogate after a delete if any
Bug: 6526328 Change-Id: Iae70cad7b3c114bc13af48ae0eadd52ab88e8471
This commit is contained in:
parent
cb53c63eab
commit
978c96aa99
1 changed files with 13 additions and 0 deletions
|
@ -2291,6 +2291,19 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
break;
|
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.
|
// receive ringer mode change and network state change.
|
||||||
|
|
Loading…
Reference in a new issue