Loading java/src/com/android/inputmethod/latin/Suggest.java +1 −1 Original line number Diff line number Diff line Loading @@ -233,7 +233,7 @@ public class Suggest { // the current settings. It may also be useful to know, when the setting is off, whether // the word *would* have been auto-corrected. if (!isCorrectionEnabled || !allowsToBeAutoCorrected || !wordComposer.isComposingWord() || suggestionsSet.isEmpty() || suggestionsSet.isEmpty() || wordComposer.hasDigits() || wordComposer.isMostlyCaps() || wordComposer.isResumed() || !hasMainDictionary()) { // If we don't have a main dictionary, we never want to auto-correct. The reason for Loading java/src/com/android/inputmethod/latin/WordComposer.java +13 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public class WordComposer { // Cache these values for performance private int mCapsCount; private int mDigitsCount; private boolean mAutoCapitalized; private int mTrailingSingleQuotesCount; private int mCodePointSize; Loading @@ -65,6 +66,7 @@ public class WordComposer { mTypedWord = new StringBuilder(source.mTypedWord); mInputPointers.copy(source.mInputPointers); mCapsCount = source.mCapsCount; mDigitsCount = source.mDigitsCount; mIsFirstCharCapitalized = source.mIsFirstCharCapitalized; mAutoCapitalized = source.mAutoCapitalized; mTrailingSingleQuotesCount = source.mTrailingSingleQuotesCount; Loading @@ -80,6 +82,7 @@ public class WordComposer { mTypedWord.setLength(0); mAutoCorrection = null; mCapsCount = 0; mDigitsCount = 0; mIsFirstCharCapitalized = false; mTrailingSingleQuotesCount = 0; mIsResumed = false; Loading Loading @@ -141,6 +144,7 @@ public class WordComposer { mIsFirstCharCapitalized = isFirstCharCapitalized( newIndex, primaryCode, mIsFirstCharCapitalized); if (Character.isUpperCase(primaryCode)) mCapsCount++; if (Character.isDigit(primaryCode)) mDigitsCount++; if (Keyboard.CODE_SINGLE_QUOTE == primaryCode) { ++mTrailingSingleQuotesCount; } else { Loading Loading @@ -213,6 +217,7 @@ public class WordComposer { mTypedWord.deleteCharAt(stringBuilderLength - 1); } if (Character.isUpperCase(lastChar)) mCapsCount--; if (Character.isDigit(lastChar)) mDigitsCount--; refreshSize(); } // We may have deleted the last one. Loading Loading @@ -267,6 +272,13 @@ public class WordComposer { return mCapsCount > 1; } /** * Returns true if we have digits in the composing word. */ public boolean hasDigits() { return mDigitsCount > 0; } /** * Saves the reason why the word is capitalized - whether it was automatic or * due to the user hitting shift in the middle of a sentence. Loading Loading @@ -322,6 +334,7 @@ public class WordComposer { lastComposedWord.deactivate(); } mCapsCount = 0; mDigitsCount = 0; mIsBatchMode = false; mTypedWord.setLength(0); mTrailingSingleQuotesCount = 0; Loading Loading
java/src/com/android/inputmethod/latin/Suggest.java +1 −1 Original line number Diff line number Diff line Loading @@ -233,7 +233,7 @@ public class Suggest { // the current settings. It may also be useful to know, when the setting is off, whether // the word *would* have been auto-corrected. if (!isCorrectionEnabled || !allowsToBeAutoCorrected || !wordComposer.isComposingWord() || suggestionsSet.isEmpty() || suggestionsSet.isEmpty() || wordComposer.hasDigits() || wordComposer.isMostlyCaps() || wordComposer.isResumed() || !hasMainDictionary()) { // If we don't have a main dictionary, we never want to auto-correct. The reason for Loading
java/src/com/android/inputmethod/latin/WordComposer.java +13 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public class WordComposer { // Cache these values for performance private int mCapsCount; private int mDigitsCount; private boolean mAutoCapitalized; private int mTrailingSingleQuotesCount; private int mCodePointSize; Loading @@ -65,6 +66,7 @@ public class WordComposer { mTypedWord = new StringBuilder(source.mTypedWord); mInputPointers.copy(source.mInputPointers); mCapsCount = source.mCapsCount; mDigitsCount = source.mDigitsCount; mIsFirstCharCapitalized = source.mIsFirstCharCapitalized; mAutoCapitalized = source.mAutoCapitalized; mTrailingSingleQuotesCount = source.mTrailingSingleQuotesCount; Loading @@ -80,6 +82,7 @@ public class WordComposer { mTypedWord.setLength(0); mAutoCorrection = null; mCapsCount = 0; mDigitsCount = 0; mIsFirstCharCapitalized = false; mTrailingSingleQuotesCount = 0; mIsResumed = false; Loading Loading @@ -141,6 +144,7 @@ public class WordComposer { mIsFirstCharCapitalized = isFirstCharCapitalized( newIndex, primaryCode, mIsFirstCharCapitalized); if (Character.isUpperCase(primaryCode)) mCapsCount++; if (Character.isDigit(primaryCode)) mDigitsCount++; if (Keyboard.CODE_SINGLE_QUOTE == primaryCode) { ++mTrailingSingleQuotesCount; } else { Loading Loading @@ -213,6 +217,7 @@ public class WordComposer { mTypedWord.deleteCharAt(stringBuilderLength - 1); } if (Character.isUpperCase(lastChar)) mCapsCount--; if (Character.isDigit(lastChar)) mDigitsCount--; refreshSize(); } // We may have deleted the last one. Loading Loading @@ -267,6 +272,13 @@ public class WordComposer { return mCapsCount > 1; } /** * Returns true if we have digits in the composing word. */ public boolean hasDigits() { return mDigitsCount > 0; } /** * Saves the reason why the word is capitalized - whether it was automatic or * due to the user hitting shift in the middle of a sentence. Loading Loading @@ -322,6 +334,7 @@ public class WordComposer { lastComposedWord.deactivate(); } mCapsCount = 0; mDigitsCount = 0; mIsBatchMode = false; mTypedWord.setLength(0); mTrailingSingleQuotesCount = 0; Loading