aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-10-02 12:46:11 +0900
committerYohei Yukawa <yukawa@google.com>2014-10-02 14:08:59 +0900
commit3852cfa717a80e617e7748865ed7465931c54a12 (patch)
tree112185bd9c0eb9e3ef7c75b9acbe5e7481066029
parenteff21b653f6ddfdd9b931aaacd0d15b53b57e84f (diff)
downloadlatinime-3852cfa717a80e617e7748865ed7465931c54a12.tar.gz
latinime-3852cfa717a80e617e7748865ed7465931c54a12.tar.xz
latinime-3852cfa717a80e617e7748865ed7465931c54a12.zip
Preserve spans when splitting sentences
This CL fixes a bug that span information was unintentionally removed when given sentences are split into words. Nothing is changed in KitKat and prior because TextInfo never returns spanned text until L. Note that the spell checker service still doesn't rely on span information even with this CL. BUG: 16419551 Change-Id: I6ffb75ee6add4ae20e9d3dcfb90b65f097d70fba
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java b/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java
index 51c4b1ee8..9ddee8629 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java
@@ -145,9 +145,8 @@ public class SentenceLevelAdapter {
int wordEnd = wordIterator.getEndOfWord(originalText, wordStart);
while (wordStart <= end && wordEnd != -1 && wordStart != -1) {
if (wordEnd >= start && wordEnd > wordStart) {
- CharSequence subSequence = originalText.subSequence(wordStart, wordEnd).toString();
- final TextInfo ti = TextInfoCompatUtils.newInstance(subSequence, 0,
- subSequence.length(), cookie, subSequence.hashCode());
+ final TextInfo ti = TextInfoCompatUtils.newInstance(originalText, wordStart,
+ wordEnd, cookie, originalText.subSequence(wordStart, wordEnd).hashCode());
wordItems.add(new SentenceWordItem(ti, wordStart, wordEnd));
}
wordStart = wordIterator.getBeginningOfNextWord(originalText, wordEnd);