From 9f9cc032773a528b4eb6e036db0c37ff45385cce Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 8 May 2013 18:44:50 +0900 Subject: Optimizations and safeguards. - Don't call finishComposingText when useless. - Add safeguards against calling setComposingRegion when the data returned by the editor is inconsistent. - Cancel pending recorrection messages when new messages arrive. Bug: 8842941 Bug: 8845001 Change-Id: I939701033cf5c2bbd85871ecf83e329021ddeb91 --- java/src/com/android/inputmethod/latin/RichInputConnection.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java') diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 8ed7ab264..980215de6 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -135,13 +135,14 @@ public final class RichInputConnection { if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug(); } - public void resetCachesUponCursorMove(final int newCursorPosition) { + public void resetCachesUponCursorMove(final int newCursorPosition, + final boolean shouldFinishComposition) { mCurrentCursorPosition = newCursorPosition; mComposingText.setLength(0); mCommittedTextBeforeComposingText.setLength(0); final CharSequence textBeforeCursor = getTextBeforeCursor(DEFAULT_TEXT_CACHE_SIZE, 0); if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor); - if (null != mIC) { + if (null != mIC && shouldFinishComposition) { mIC.finishComposingText(); if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.richInputConnection_finishComposingText(); -- cgit v1.2.3-83-g751a