diff options
author | 2014-05-16 07:47:52 +0000 | |
---|---|---|
committer | 2014-05-16 07:47:52 +0000 | |
commit | f1b3518d7181a56d4b50f32e21438003edfd4355 (patch) | |
tree | 8e366e4187c6fbc7d887b64793cc35463a458982 /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | cfd3093362e2447bca948b94ceabba404b376b4b (diff) | |
parent | 34873a66f03e0b9945474213fa2bc48cc272a7ca (diff) | |
download | latinime-f1b3518d7181a56d4b50f32e21438003edfd4355.tar.gz latinime-f1b3518d7181a56d4b50f32e21438003edfd4355.tar.xz latinime-f1b3518d7181a56d4b50f32e21438003edfd4355.zip |
Merge "Fix: StringIndexOutOfBoundsException."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index ac6972928..9cf71c7f4 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -149,7 +149,8 @@ public final class WordComposer { public int copyCodePointsExceptTrailingSingleQuotesAndReturnCodePointCount( final int[] destination) { // lastIndex is exclusive - final int lastIndex = mTypedWordCache.length() - trailingSingleQuotesCount(); + final int lastIndex = mTypedWordCache.length() + - StringUtils.getTrailingSingleQuotesCount(mTypedWordCache); if (lastIndex <= 0) { // The string is empty or contains only single quotes. return 0; @@ -331,15 +332,6 @@ public final class WordComposer { return mIsFirstCharCapitalized; } - public int trailingSingleQuotesCount() { - final int lastIndex = mTypedWordCache.length() - 1; - int i = lastIndex; - while (i >= 0 && mTypedWordCache.charAt(i) == Constants.CODE_SINGLE_QUOTE) { - --i; - } - return lastIndex - i; - } - /** * Whether or not all of the user typed chars are upper case * @return true if all user typed chars are upper case, false otherwise |