diff options
author | 2012-09-13 02:59:17 -0700 | |
---|---|---|
committer | 2012-09-13 02:59:17 -0700 | |
commit | 995087944764c74e3aef73229f9ac036b078c282 (patch) | |
tree | 10c4bdc5c503fcdcc38c3a04cc0c25e4c4cffcca /java/src/com/android/inputmethod/latin/RichInputConnection.java | |
parent | 265083c85a656b4abfa1ec2470c61a12d967e8c9 (diff) | |
parent | 2427f578c8fafa85f3f9f74c00384f785e489bcf (diff) | |
download | latinime-995087944764c74e3aef73229f9ac036b078c282.tar.gz latinime-995087944764c74e3aef73229f9ac036b078c282.tar.xz latinime-995087944764c74e3aef73229f9ac036b078c282.zip |
am 2427f578: Merge "Import TextUtils.getCapsMode to fix it internally (A1)" into jb-mr1-dev
* commit '2427f578c8fafa85f3f9f74c00384f785e489bcf':
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.java | 15 |
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) { |