Fix a theoretical bug (A12)
If a word is a dictionary word but still has no suggestion, this method should return true. In the practice, it makes no difference since a word without suggestion won't be changed anyway. Change-Id: Ib1f5ef254b7da7e5cedb2f973529ad431beb93f9
This commit is contained in:
parent
9701b360d9
commit
d426941ee8
1 changed files with 3 additions and 5 deletions
|
@ -38,8 +38,7 @@ public class AutoCorrection {
|
||||||
final CharSequence whitelistedWord) {
|
final CharSequence whitelistedWord) {
|
||||||
if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
|
if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) {
|
||||||
return whitelistedWord;
|
return whitelistedWord;
|
||||||
} else if (shouldAutoCorrectToSelf(
|
} else if (shouldAutoCorrectToSelf(dictionaries, wordComposer, consideredWord)) {
|
||||||
dictionaries, wordComposer, suggestion, consideredWord)) {
|
|
||||||
return consideredWord;
|
return consideredWord;
|
||||||
} else if (hasAutoCorrectionForBinaryDictionary(wordComposer, suggestion,
|
} else if (hasAutoCorrectionForBinaryDictionary(wordComposer, suggestion,
|
||||||
consideredWord, autoCorrectionThreshold)) {
|
consideredWord, autoCorrectionThreshold)) {
|
||||||
|
@ -111,10 +110,9 @@ public class AutoCorrection {
|
||||||
|
|
||||||
private static boolean shouldAutoCorrectToSelf(
|
private static boolean shouldAutoCorrectToSelf(
|
||||||
final ConcurrentHashMap<String, Dictionary> dictionaries,
|
final ConcurrentHashMap<String, Dictionary> dictionaries,
|
||||||
final WordComposer wordComposer, final SuggestedWordInfo suggestion,
|
final WordComposer wordComposer, final CharSequence consideredWord) {
|
||||||
final CharSequence consideredWord) {
|
|
||||||
if (TextUtils.isEmpty(consideredWord)) return false;
|
if (TextUtils.isEmpty(consideredWord)) return false;
|
||||||
return wordComposer.size() > 1 && null != suggestion
|
return wordComposer.size() > 1
|
||||||
&& !allowsToBeAutoCorrected(dictionaries, consideredWord, false);
|
&& !allowsToBeAutoCorrected(dictionaries, consideredWord, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue