diff options
author | 2012-02-02 20:09:39 -0800 | |
---|---|---|
committer | 2012-02-02 20:09:39 -0800 | |
commit | 7876326bf1140b6f97df5550e954a5e6cfc5ee7e (patch) | |
tree | 50164e8ab87f24e8e53508bda28f0fe4dbc72b68 /java/src | |
parent | 0210a93acd7982d027df974320777d6edb47b300 (diff) | |
parent | 825e2bbd910cce3055a4ca808d3744bc0b2cedda (diff) | |
download | latinime-7876326bf1140b6f97df5550e954a5e6cfc5ee7e.tar.gz latinime-7876326bf1140b6f97df5550e954a5e6cfc5ee7e.tar.xz latinime-7876326bf1140b6f97df5550e954a5e6cfc5ee7e.zip |
am 825e2bbd: Fix a bug when deleting the last char
* commit '825e2bbd910cce3055a4ca808d3744bc0b2cedda':
Fix a bug when deleting the last char
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index fa1b5ef6c..dd24432f7 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -212,6 +212,7 @@ public class WordComposer { final int lastPos = size - 1; char lastChar = mTypedWord.charAt(lastPos); mCodes.remove(lastPos); + // TODO: This crashes and catches fire if the code point doesn't fit a char mTypedWord.deleteCharAt(lastPos); if (Character.isUpperCase(lastChar)) mCapsCount--; } @@ -221,8 +222,9 @@ public class WordComposer { if (mTrailingSingleQuotesCount > 0) { --mTrailingSingleQuotesCount; } else { - for (int i = mTypedWord.offsetByCodePoints(mTypedWord.length(), -1); - i >= 0; i = mTypedWord.offsetByCodePoints(i, -1)) { + int i = mTypedWord.length(); + while (i > 0) { + i = mTypedWord.offsetByCodePoints(i, -1); if (Keyboard.CODE_SINGLE_QUOTE != mTypedWord.codePointAt(i)) break; ++mTrailingSingleQuotesCount; } |