aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-09-13 14:11:35 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-09-13 14:11:35 -0700
commit962a5f63b7c37b300f1986538562f869a632e63b (patch)
tree10c4bdc5c503fcdcc38c3a04cc0c25e4c4cffcca /java/src/com/android/inputmethod/latin/RichInputConnection.java
parentf41b836a133cf22f872015e87763ab0e50babec6 (diff)
parent995087944764c74e3aef73229f9ac036b078c282 (diff)
downloadlatinime-962a5f63b7c37b300f1986538562f869a632e63b.tar.gz
latinime-962a5f63b7c37b300f1986538562f869a632e63b.tar.xz
latinime-962a5f63b7c37b300f1986538562f869a632e63b.zip
am 99508794: am 2427f578: Merge "Import TextUtils.getCapsMode to fix it internally (A1)" into jb-mr1-dev
* commit '995087944764c74e3aef73229f9ac036b078c282': Import TextUtils.getCapsMode to fix it internally (A1)
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index ce7049f4f..f77d6860e 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -192,7 +192,20 @@ public class RichInputConnection {
public int getCursorCapsMode(final int inputType) {
mIC = mParent.getCurrentInputConnection();
if (null == mIC) return Constants.TextUtils.CAP_MODE_OFF;
- return mIC.getCursorCapsMode(inputType);
+ if (!TextUtils.isEmpty(mComposingText)) return Constants.TextUtils.CAP_MODE_OFF;
+ // 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.
+ // getCapsMode should be updated to be able to return a "not enough info" result so that
+ // we can get more context only when needed.
+ if (TextUtils.isEmpty(mCommittedTextBeforeComposingText) && 0 != mCurrentCursorPosition) {
+ mCommittedTextBeforeComposingText.append(
+ getTextBeforeCursor(DEFAULT_TEXT_CACHE_SIZE, 0));
+ }
+ // This never calls InputConnection#getCapsMode - in fact, it's a static method that
+ // never blocks or initiates IPC.
+ return StringUtils.getCapsMode(mCommittedTextBeforeComposingText,
+ mCommittedTextBeforeComposingText.length(), inputType);
}
public CharSequence getTextBeforeCursor(final int i, final int j) {