aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-11-21 00:21:09 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-21 00:21:09 -0800
commit6ecd1e1280578e95e5c2e24046cf67f0f7260c3b (patch)
treea453fec49a8d687c9cdbea884fd702ccfc3b3847 /java/src/com/android/inputmethod/latin/LatinIME.java
parent0e4275730b7a90a51974ad8c40e0f46e4a63aaa1 (diff)
parentc83359f9746ca6f0269a1a7017b585c1a5cab9b8 (diff)
downloadlatinime-6ecd1e1280578e95e5c2e24046cf67f0f7260c3b.tar.gz
latinime-6ecd1e1280578e95e5c2e24046cf67f0f7260c3b.tar.xz
latinime-6ecd1e1280578e95e5c2e24046cf67f0f7260c3b.zip
Merge "Special case quotes at start and end of words"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 73a8f1f8d..655c46eed 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1548,6 +1548,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mComposingStateManager.onFinishComposingText();
}
}
+ if (code == Keyboard.CODE_SINGLE_QUOTE && !isCursorTouchingWord()) {
+ mHasUncommittedTypedChars = false;
+ }
final KeyboardSwitcher switcher = mKeyboardSwitcher;
if (switcher.isShiftedOrShiftLocked()) {
if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT
@@ -1820,7 +1823,15 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// a boolean flag. Right now this is handled with a slight hack in
// WhitelistDictionary#shouldForciblyAutoCorrectFrom.
final boolean allowsToBeAutoCorrected = AutoCorrection.allowsToBeAutoCorrected(
- mSuggest.getUnigramDictionaries(), typedWord, preferCapitalization());
+ mSuggest.getUnigramDictionaries(),
+ // If the typed string ends with a single quote, for dictionary lookup purposes
+ // we behave as if the single quote was not here. Here, we are looking up the
+ // typed string in the dictionary (to avoid autocorrecting from an existing
+ // word, so for consistency this lookup should be made WITHOUT the trailing
+ // single quote.
+ wordComposer.isLastCharASingleQuote()
+ ? typedWord.subSequence(0, typedWord.length() - 1) : typedWord,
+ preferCapitalization());
if (mCorrectionMode == Suggest.CORRECTION_FULL
|| mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) {
autoCorrectionAvailable |= (!allowsToBeAutoCorrected);