Merge "Fix a bug in sentence detection when input is too long." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
87d4c9a9ca
@@ -827,7 +827,7 @@ public class SpellChecker implements SpellCheckerSessionListener {
|
||||
// The offset should be rounded up to word boundary.
|
||||
int uncheckedLength = sentenceEnd - textChangeStart;
|
||||
if (uncheckedLength > MAX_SENTENCE_LENGTH) {
|
||||
sentenceEnd = findSeparator(sequence, sentenceStart + MAX_SENTENCE_LENGTH,
|
||||
sentenceEnd = findSeparator(sequence, textChangeStart + MAX_SENTENCE_LENGTH,
|
||||
sentenceEnd);
|
||||
sentenceStart = roundUpToWordStart(sequence, textChangeStart, sentenceStart);
|
||||
} else {
|
||||
@@ -835,7 +835,7 @@ public class SpellChecker implements SpellCheckerSessionListener {
|
||||
sentenceStart);
|
||||
}
|
||||
}
|
||||
return new Range(sentenceStart, sentenceEnd);
|
||||
return new Range<>(sentenceStart, Math.max(sentenceStart, sentenceEnd));
|
||||
}
|
||||
|
||||
private int roundUpToWordStart(CharSequence sequence, int position, int frontBoundary) {
|
||||
|
||||
Reference in New Issue
Block a user