aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-05-22 18:41:27 +0900
committerJean Chalard <jchalard@google.com>2012-05-22 19:04:31 +0900
commit978c96aa995015658070346b60826a3a34fdaf84 (patch)
treeb3781bcb04d8180bfd3ba57c9d9e718bb19d846c /java/src
parentcb53c63eabf006283ec973f41f3f7d7fc4155f0d (diff)
downloadlatinime-978c96aa995015658070346b60826a3a34fdaf84.tar.gz
latinime-978c96aa995015658070346b60826a3a34fdaf84.tar.xz
latinime-978c96aa995015658070346b60826a3a34fdaf84.zip
Remove a high surrogate after a delete if any
Bug: 6526328 Change-Id: Iae70cad7b3c114bc13af48ae0eadd52ab88e8471
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index b474a8558..139eb46ca 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -2291,6 +2291,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.