mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
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
This commit is contained in:
parent
eff21b653f
commit
3852cfa717
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user