From f712dc9a4f17ee4a6916b0f477e89d1bc34a4d70 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 26 Jul 2013 12:57:12 +0900 Subject: [PATCH] Very simple refactoring Bug: 8864306 Change-Id: I5c9b118cb6a8eb59efc52d5534b10fcab93182d6 --- .../android/inputmethod/latin/RichInputConnection.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 8264f6a6d..c6193faaf 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -139,13 +139,17 @@ public final class RichInputConnection { if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug(); } - public void resetCachesUponCursorMove(final int newCursorPosition, - final boolean shouldFinishComposition) { - mCurrentCursorPosition = newCursorPosition; + private void refreshCache() { mComposingText.setLength(0); mCommittedTextBeforeComposingText.setLength(0); final CharSequence textBeforeCursor = getTextBeforeCursor(DEFAULT_TEXT_CACHE_SIZE, 0); if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor); + } + + public void resetCachesUponCursorMove(final int newCursorPosition, + final boolean shouldFinishComposition) { + mCurrentCursorPosition = newCursorPosition; + refreshCache(); if (null != mIC && shouldFinishComposition) { mIC.finishComposingText(); if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {