From 5eeff7cf547e3694315473a91bed0d5afdc5709e Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Sun, 19 Feb 2012 18:02:40 -0800 Subject: [PATCH] Converge paths of an if() branch This is to help with further refactoring. Change-Id: Ib2459903862570cf7022fd90f2d5c524a6bbbe19 --- .../com/android/inputmethod/latin/LatinIME.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index ce306eaad..dcb114682 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -903,10 +903,20 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mComposingStateManager.onFinishComposingText(); mVoiceProxy.setVoiceInputHighlighted(false); } else if (!mWordComposer.isComposingWord()) { - // TODO: is the following reset still needed, given that we are not composing - // a word? + // We need to do this to clear the last composed word. resetComposingState(true /* alsoResetLastComposedWord */); updateSuggestions(); + // Calling finishComposingText() here is harmless because there + // is no composing word, so it's a no-op. + final InputConnection ic = getCurrentInputConnection(); + if (ic != null) { + ic.finishComposingText(); + } + // Likewise, this is a no-op since we are not composing text + mComposingStateManager.onFinishComposingText(); + // The cursor moved so it's safe to assume that the voice input + // is not highlighted + mVoiceProxy.setVoiceInputHighlighted(false); } mHandler.postUpdateShiftState();