aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-09-24 03:14:57 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-24 03:14:57 -0700
commit821bff9202d4ffc5d0ccabdda6bb4f91a83c5838 (patch)
treec2bc15e6cbdb8ea41e9b071518296c3debb0239e /java/src/com/android/inputmethod/latin/RichInputConnection.java
parentc3f7ddd73de360c12b9433106d925f61775b108a (diff)
parent3d68b066626d7e58cbe2853cd186b1ad75b90259 (diff)
downloadlatinime-821bff9202d4ffc5d0ccabdda6bb4f91a83c5838.tar.gz
latinime-821bff9202d4ffc5d0ccabdda6bb4f91a83c5838.tar.xz
latinime-821bff9202d4ffc5d0ccabdda6bb4f91a83c5838.zip
am 3d68b066: Copy only the spans we are interested in.
* commit '3d68b066626d7e58cbe2853cd186b1ad75b90259': Copy only the spans we are interested in.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index fa7f23efb..925381b50 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -607,8 +607,11 @@ public final class RichInputConnection {
}
}
- return new TextRange(TextUtils.concat(before, after), startIndexInBefore,
- before.length() + endIndexInAfter, before.length());
+ // We don't use TextUtils#concat because it copies all spans without respect to their
+ // nature. If the text includes a PARAGRAPH span and it has been split, then
+ // TextUtils#concat will crash when it tries to concat both sides of it.
+ return new TextRange(StringUtils.concatWithNonParagraphSuggestionSpansOnly(before, after),
+ startIndexInBefore, before.length() + endIndexInAfter, before.length());
}
public boolean isCursorTouchingWord(final SettingsValues settingsValues) {