Fix: wrong auto correction for whilelist and personalized words.

This happens when there are tailing single quotes.

Bug: 13237314
Change-Id: I7fd2a20b25ac2217f9621d7f2510345bbd633c14
main
Keisuke Kuroyanagi 2014-02-28 21:24:26 +09:00
parent 472e22a326
commit 23ae574a11
1 changed files with 4 additions and 4 deletions

View File

@ -142,8 +142,8 @@ public final class Suggest {
whitelistedWord = firstSuggestion = null; whitelistedWord = firstSuggestion = null;
} else { } else {
final SuggestedWordInfo firstSuggestedWordInfo = getTransformedSuggestedWordInfo( final SuggestedWordInfo firstSuggestedWordInfo = getTransformedSuggestedWordInfo(
suggestionsSet.first(), mLocale, isAllUpperCase, isFirstCharCapitalized, suggestionsSet.first(), mLocale, isAllUpperCase, isFirstCharCapitalized,
trailingSingleQuotesCount); trailingSingleQuotesCount);
firstSuggestion = firstSuggestedWordInfo.mWord; firstSuggestion = firstSuggestedWordInfo.mWord;
if (SuggestedWordInfo.KIND_WHITELIST != firstSuggestedWordInfo.mKind) { if (SuggestedWordInfo.KIND_WHITELIST != firstSuggestedWordInfo.mKind) {
whitelistedWord = null; whitelistedWord = null;
@ -161,10 +161,10 @@ public final class Suggest {
// TODO: stop relying on indices to find where is the auto-correction in the suggested // TODO: stop relying on indices to find where is the auto-correction in the suggested
// words, and correct this test. // words, and correct this test.
final boolean allowsToBeAutoCorrected = (null != whitelistedWord final boolean allowsToBeAutoCorrected = (null != whitelistedWord
&& !whitelistedWord.equals(consideredWord)) && !whitelistedWord.equals(typedWord))
|| (consideredWord.length() > 1 && !mDictionaryFacilitator.isValidWord( || (consideredWord.length() > 1 && !mDictionaryFacilitator.isValidWord(
consideredWord, wordComposer.isFirstCharCapitalized()) consideredWord, wordComposer.isFirstCharCapitalized())
&& !consideredWord.equals(firstSuggestion)); && !typedWord.equals(firstSuggestion));
final boolean hasAutoCorrection; final boolean hasAutoCorrection;
// TODO: using isCorrectionEnabled here is not very good. It's probably useless, because // TODO: using isCorrectionEnabled here is not very good. It's probably useless, because