From 7fcf304c974d52a816b3375f22e714798fe308e5 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 26 Jun 2013 11:32:07 +0900 Subject: [PATCH] Fixing follow-up to I548d899b I548d899b introduced a new method to fix a sync miss between the cursor position and the cached cursor position, but did not take into account that it should also update the cached text before and after the cursor in this case and that there was already a method for doing this. Change-Id: I31bd741893207c822827304e77791b1159774e1a --- java/src/com/android/inputmethod/latin/LatinIME.java | 8 +++++++- .../android/inputmethod/latin/RichInputConnection.java | 8 -------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 6fcac9a65..9ef273918 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -968,6 +968,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // text, but that is probably too expensive to do, so we decided to leave things // as is. resetEntireInputState(newSelStart); + } else { + // resetEntireInputState calls resetCachesUponCursorMove, but with the second + // argument as true. But in all cases where we don't reset the entire input state, + // we still want to tell the rich input connection about the new cursor position so + // that it can update its caches. + mConnection.resetCachesUponCursorMove(newSelStart, + false /* shouldFinishComposition */); } // We moved the cursor. If we are touching a word, we need to resume suggestion, @@ -975,7 +982,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (isSuggestionsStripVisible()) { mHandler.postResumeSuggestions(); } - mConnection.userMovedCursor(newSelEnd); // Reset the last recapitalization. mRecapitalizeStatus.deactivate(); mKeyboardSwitcher.updateShiftState(); diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 6e3e7b218..5391b1303 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -729,14 +729,6 @@ public final class RichInputConnection { return (newSelStart - oldSelStart) * (mCurrentCursorPosition - newSelStart) >= 0; } - /** - * The user moved the cursor by hand. Take a note of it. - * @param newCursorPosition The new cursor position. - */ - public void userMovedCursor(final int newCursorPosition) { - mCurrentCursorPosition = newCursorPosition; - } - /** * Looks at the text just before the cursor to find out if it looks like a URL. *