am 59418672: Merge "Don\'t resume suggestion on digits."

* commit '59418672a140db38b9f17fee6d7df399897fbb39':
  Don't resume suggestion on digits.
main
Jean Chalard 2013-09-18 00:09:05 -07:00 committed by Android Git Automerger
commit 6e0bdd58be
1 changed files with 8 additions and 0 deletions

View File

@ -2685,6 +2685,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return prevWord;
}
private boolean isResumableWord(final String word, final SettingsValues settings) {
final int firstCodePoint = word.codePointAt(0);
return settings.isWordCodePoint(firstCodePoint)
&& Constants.CODE_SINGLE_QUOTE != firstCodePoint
&& Constants.CODE_DASH != firstCodePoint;
}
/**
* Check if the cursor is touching a word. If so, restart suggestions on this word, else
* do nothing.
@ -2714,6 +2721,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (numberOfCharsInWordBeforeCursor > mLastSelectionStart) return;
final ArrayList<SuggestedWordInfo> suggestions = CollectionUtils.newArrayList();
final String typedWord = range.mWord.toString();
if (!isResumableWord(typedWord, currentSettings)) return;
int i = 0;
for (final SuggestionSpan span : range.getSuggestionSpansAtWord()) {
for (final String s : span.getSuggestions()) {