File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ public class SpellChecker implements SpellCheckerSessionListener {
6060 // Pause between each spell check to keep the UI smooth
6161 private final static int SPELL_PAUSE_DURATION = 400 ; // milliseconds
6262
63+ private static final int MIN_SENTENCE_LENGTH = 50 ;
64+
6365 private static final int USE_SPAN_RANGE = -1 ;
6466
6567 private final TextView mTextView ;
@@ -508,11 +510,10 @@ public void parse() {
508510 if (wordEnd < start ) {
509511 return ;
510512 }
511- wordStart = regionEnd ;
512513 // TODO: Find the start position of the sentence.
513514 // Set span with the context
514515 final int spellCheckStart = Math .max (
515- 0 , Math .min (wordStart , regionEnd - WORD_ITERATOR_INTERVAL ));
516+ 0 , Math .min (wordStart , regionEnd - MIN_SENTENCE_LENGTH ));
516517 if (regionEnd <= spellCheckStart ) {
517518 return ;
518519 }
@@ -530,6 +531,7 @@ public void parse() {
530531 && (selectionEnd < spellCheckStart || selectionStart > regionEnd )) {
531532 addSpellCheckSpan (editable , spellCheckStart , regionEnd );
532533 }
534+ wordStart = regionEnd ;
533535 } else {
534536 while (wordStart <= end ) {
535537 if (wordEnd >= start && wordEnd > wordStart ) {
You can’t perform that action at this time.
0 commit comments