am 45ebb200: Merge "Preserve spans when splitting sentences"

* commit '45ebb2001d5fe88f1b726cdba3011de3a606eaa6':
  Preserve spans when splitting sentences
main
Yohei Yukawa 2014-10-02 09:36:07 +00:00 committed by Android Git Automerger
commit 691ac05085
1 changed files with 2 additions and 3 deletions

View File

@ -145,9 +145,8 @@ public class SentenceLevelAdapter {
int wordEnd = wordIterator.getEndOfWord(originalText, wordStart); int wordEnd = wordIterator.getEndOfWord(originalText, wordStart);
while (wordStart <= end && wordEnd != -1 && wordStart != -1) { while (wordStart <= end && wordEnd != -1 && wordStart != -1) {
if (wordEnd >= start && wordEnd > wordStart) { if (wordEnd >= start && wordEnd > wordStart) {
CharSequence subSequence = originalText.subSequence(wordStart, wordEnd).toString(); final TextInfo ti = TextInfoCompatUtils.newInstance(originalText, wordStart,
final TextInfo ti = TextInfoCompatUtils.newInstance(subSequence, 0, wordEnd, cookie, originalText.subSequence(wordStart, wordEnd).hashCode());
subSequence.length(), cookie, subSequence.hashCode());
wordItems.add(new SentenceWordItem(ti, wordStart, wordEnd)); wordItems.add(new SentenceWordItem(ti, wordStart, wordEnd));
} }
wordStart = wordIterator.getBeginningOfNextWord(originalText, wordEnd); wordStart = wordIterator.getBeginningOfNextWord(originalText, wordEnd);