Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd4cb6a4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix a bug in sentence detection when input is too long." into sc-dev am: 87d4c9a9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14674299

Change-Id: I485e3411e8a1cd411fd69e4313c0c8a658b2b814
parents a74ddcdf 87d4c9a9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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) {