From d461bfd6601dfb6d4a4f78be0ff129597af895ff Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 14 Sep 2012 18:53:56 +0900 Subject: [PATCH] Support the gesture + phantom space case (A13) Bug: 6950087 Change-Id: I198699f6e687ac74c35b9edfe469dce880d9ecaf --- .../inputmethod/latin/RichInputConnection.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index cbc6a93fa..28c0c0f16 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -209,7 +209,16 @@ public class RichInputConnection { final boolean hasSpaceBefore) { mIC = mParent.getCurrentInputConnection(); if (null == mIC) return Constants.TextUtils.CAP_MODE_OFF; - if (!TextUtils.isEmpty(mComposingText)) return Constants.TextUtils.CAP_MODE_OFF; + if (!TextUtils.isEmpty(mComposingText)) { + if (hasSpaceBefore) { + // If we have some composing text and a space before, then we should have + // MODE_CHARACTERS and MODE_WORDS on. + return (TextUtils.CAP_MODE_CHARACTERS | TextUtils.CAP_MODE_WORDS) & inputType; + } else { + // We have some composing text - we should be in MODE_CHARACTERS only. + return TextUtils.CAP_MODE_CHARACTERS & inputType; + } + } // TODO: this will generally work, but there may be cases where the buffer contains SOME // information but not enough to determine the caps mode accurately. This may happen after // heavy pressing of delete, for example DEFAULT_TEXT_CACHE_SIZE - 5 times or so.