aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-11-18 20:03:38 +0900
committerJean Chalard <jchalard@google.com>2011-11-21 16:34:39 +0900
commitc83359f9746ca6f0269a1a7017b585c1a5cab9b8 (patch)
tree07032b4ee08310b21b580e7245cb47301a772a3d /java/src/com/android/inputmethod/latin/LatinIME.java
parent7800a313f10ebeba32864d66edd55e6a5db80114 (diff)
downloadlatinime-c83359f9746ca6f0269a1a7017b585c1a5cab9b8.tar.gz
latinime-c83359f9746ca6f0269a1a7017b585c1a5cab9b8.tar.xz
latinime-c83359f9746ca6f0269a1a7017b585c1a5cab9b8.zip
Special case quotes at start and end of words
Single quote at start of word is not considered a part of a word any more. Single quote at the end of a word now behave like capitalization: lookup in the dictionary is done *disregarding* a final quote, and it is forcefully added back into the suggestions afterwards. Bug: 5566368 Change-Id: I14dd3815f4b743edba56d64a3abdf4b73d863a6a
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 167e500f6..d72f8652d 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1503,6 +1503,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
@@ -1775,7 +1778,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);