aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-09-20 15:52:40 +0900
committerJean Chalard <jchalard@google.com>2012-09-20 16:14:16 +0900
commitb4e74cfc87ccb0523da18cb9fe30a6d08d1a04e2 (patch)
tree7bba7752e69a701e69ff8097bf896b43e809263e /java/src
parentbfcd2b3fc0ae7269396d4f694827928630b89d59 (diff)
downloadlatinime-b4e74cfc87ccb0523da18cb9fe30a6d08d1a04e2.tar.gz
latinime-b4e74cfc87ccb0523da18cb9fe30a6d08d1a04e2.tar.xz
latinime-b4e74cfc87ccb0523da18cb9fe30a6d08d1a04e2.zip
Auto correct on gesture when typed word is 1 char long
Bug: 7178462 Change-Id: I779d8ee4a957a9d1fdcc80d33257a98965dec7b8
Diffstat (limited to 'java/src')
-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 bf64b4f08..9252b0980 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1401,7 +1401,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
Stats.onAutoCorrection("", mWordComposer.getTypedWord(), " ", mWordComposer);
}
}
- commitTyped(LastComposedWord.NOT_A_SEPARATOR);
+ if (mWordComposer.size() <= 1) {
+ // We auto-correct the previous (typed, not gestured) string iff it's one character
+ // long. The reason for this is, even in the middle of gesture typing, you'll still
+ // tap one-letter words and you want them auto-corrected (typically, "i" in English
+ // should become "I"). However for any longer word, we assume that the reason for
+ // tapping probably is that the word you intend to type is not in the dictionary,
+ // so we do not attempt to correct, on the assumption that if that was a dictionary
+ // word, the user would probably have gestured instead.
+ commitCurrentAutoCorrection(LastComposedWord.NOT_A_SEPARATOR);
+ } else {
+ commitTyped(LastComposedWord.NOT_A_SEPARATOR);
+ }
mExpectingUpdateSelection = true;
// The following is necessary for the case where the user typed something but didn't
// manual pick it and didn't input any separator.