aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-05-22 03:33:42 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-22 03:33:42 -0700
commit37105e8636fc84f9e903581443730a0bf6692996 (patch)
tree0e30b0488e7077bcc91e6eb3f947c5b842dac826 /java/src
parente0f8476f71be89e78530f739bee91dd78cdbbc44 (diff)
parent09c4909c7c7ec6eaf3de943547c43a341dc14fe7 (diff)
downloadlatinime-37105e8636fc84f9e903581443730a0bf6692996.tar.gz
latinime-37105e8636fc84f9e903581443730a0bf6692996.tar.xz
latinime-37105e8636fc84f9e903581443730a0bf6692996.zip
am 09c4909c: Merge "Remove a high surrogate after a delete if any" into jb-dev
* commit '09c4909c7c7ec6eaf3de943547c43a341dc14fe7': Remove a high surrogate after a delete if any
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.