summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author satok <satok@google.com> 2012-04-22 22:39:48 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2012-04-22 22:39:48 -0700
commiteb65757d24a97450fed160d66e86a4a62c392c5c (patch)
tree4b78fb22691bffe6fd659406c36d0ab66ac1cbd8
parent49b0246bc46c2a3cdfadec5d3f56a8212678ac6e (diff)
parent979de903695275bae08f2e7a4e99d342f0facd23 (diff)
Merge "Fix the first boundary of the sentence level spell check"
-rw-r--r--core/java/android/widget/SpellChecker.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index a13ee5a3c335..02cb46b8a79a 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -60,6 +60,8 @@ public class SpellChecker implements SpellCheckerSessionListener {
// Pause between each spell check to keep the UI smooth
private final static int SPELL_PAUSE_DURATION = 400; // milliseconds
+ private static final int MIN_SENTENCE_LENGTH = 50;
+
private static final int USE_SPAN_RANGE = -1;
private final TextView mTextView;
@@ -508,11 +510,10 @@ public class SpellChecker implements SpellCheckerSessionListener {
if (wordEnd < start) {
return;
}
- wordStart = regionEnd;
// TODO: Find the start position of the sentence.
// Set span with the context
final int spellCheckStart = Math.max(
- 0, Math.min(wordStart, regionEnd - WORD_ITERATOR_INTERVAL));
+ 0, Math.min(wordStart, regionEnd - MIN_SENTENCE_LENGTH));
if (regionEnd <= spellCheckStart) {
return;
}
@@ -530,6 +531,7 @@ public class SpellChecker implements SpellCheckerSessionListener {
&& (selectionEnd < spellCheckStart || selectionStart > regionEnd)) {
addSpellCheckSpan(editable, spellCheckStart, regionEnd);
}
+ wordStart = regionEnd;
} else {
while (wordStart <= end) {
if (wordEnd >= start && wordEnd > wordStart) {