From a74ae9c451a057e7580737df328d5a972fee17af Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 14 Aug 2013 16:00:28 +0900 Subject: [PATCH] Fix a bug with surrogate pairs Bug: 10316781 Change-Id: I528c59c8823cda11975cb01b0ae59f12cfadef3b --- java/src/com/android/inputmethod/latin/LatinIME.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 08a542965..5323f2b1a 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2555,8 +2555,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } } mWordComposer.setComposingWord(typedWord, mKeyboardSwitcher.getKeyboard()); - // TODO: this is in chars but the callee expects code points! - mWordComposer.setCursorPositionWithinWord(numberOfCharsInWordBeforeCursor); + mWordComposer.setCursorPositionWithinWord( + typedWord.codePointCount(0, numberOfCharsInWordBeforeCursor)); mConnection.setComposingRegion( mLastSelectionStart - numberOfCharsInWordBeforeCursor, mLastSelectionEnd + range.getNumberOfCharsInWordAfterCursor());