From 61cc2a33911ff2a8115ce727c8cac6d73d989c42 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 9 Nov 2012 18:58:50 +0900 Subject: [PATCH 1/3] Don't restrict reset composing state to non-identical setText Bug: 7497063 Change-Id: Ifbd5c37408131867458fd921bdef46ef90d81478 --- .../android/inputmethod/latin/LatinIME.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index cf7eea70b..9dd5351f9 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -704,21 +704,17 @@ public final class LatinIME extends InputMethodService implements KeyboardAction updateFullscreenMode(); mApplicationSpecifiedCompletions = null; - if (isDifferentTextField || selectionChanged) { - // If the selection changed, we reset the input state. Essentially, we come here with - // restarting == true when the app called setText() or similar. We should reset the - // state if the app set the text to something else, but keep it if it set a suggestion - // or something. - mEnteredText = null; - resetComposingState(true /* alsoResetLastComposedWord */); - mDeleteCount = 0; - mSpaceState = SPACE_STATE_NONE; + // The app calling setText() has the effect of clearing the composing + // span, so we should reset our state unconditionally, even if restarting is true. + mEnteredText = null; + resetComposingState(true /* alsoResetLastComposedWord */); + mDeleteCount = 0; + mSpaceState = SPACE_STATE_NONE; - if (mSuggestionStripView != null) { - // This will set the punctuation suggestions if next word suggestion is off; - // otherwise it will clear the suggestion strip. - setPunctuationSuggestions(); - } + if (mSuggestionStripView != null) { + // This will set the punctuation suggestions if next word suggestion is off; + // otherwise it will clear the suggestion strip. + setPunctuationSuggestions(); } mConnection.resetCachesUponCursorMove(editorInfo.initialSelStart); From 0e84041bf740590230198fa845d8c45acd4cb586 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Mon, 12 Nov 2012 14:05:51 +0900 Subject: [PATCH 2/3] Refactor all phantom-space-inserted spaces in one place Bug: 7164981 Change-Id: If1635c212b2d5d9cf51f5fb074f3b20dd7ec7b2a --- .../com/android/inputmethod/latin/LatinIME.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index cf7eea70b..023619dc9 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1405,7 +1405,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mHandler.postUpdateSuggestionStrip(); final CharSequence text = specificTldProcessingOnTextInput(rawText); if (SPACE_STATE_PHANTOM == mSpaceState) { - sendKeyCodePoint(Keyboard.CODE_SPACE); + promotePhantomSpace(); } mConnection.commitText(text, 1); mConnection.endBatchEdit(); @@ -1568,7 +1568,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mWordComposer.setBatchInputWord(batchInputText); mConnection.beginBatchEdit(); if (SPACE_STATE_PHANTOM == mSpaceState) { - sendKeyCodePoint(Keyboard.CODE_SPACE); + promotePhantomSpace(); } mConnection.setComposingText(batchInputText, 1); mExpectingUpdateSelection = true; @@ -1724,7 +1724,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Sanity check throw new RuntimeException("Should not be composing here"); } - sendKeyCodePoint(Keyboard.CODE_SPACE); + promotePhantomSpace(); } // NOTE: isCursorTouchingWord() is a blocking IPC call, so it often takes several @@ -1802,7 +1802,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (SPACE_STATE_PHANTOM == spaceState && mCurrentSettings.isPhantomSpacePromotingSymbol(primaryCode)) { - sendKeyCodePoint(Keyboard.CODE_SPACE); + promotePhantomSpace(); } sendKeyCodePoint(primaryCode); @@ -2071,7 +2071,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction int firstChar = Character.codePointAt(suggestion, 0); if ((!mCurrentSettings.isWeakSpaceStripper(firstChar)) && (!mCurrentSettings.isWeakSpaceSwapper(firstChar))) { - sendKeyCodePoint(Keyboard.CODE_SPACE); + promotePhantomSpace(); } } @@ -2249,6 +2249,11 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mHandler.postUpdateSuggestionStrip(); } + // This essentially inserts a space, and that's it. + public void promotePhantomSpace() { + sendKeyCodePoint(Keyboard.CODE_SPACE); + } + // Used by the RingCharBuffer public boolean isWordSeparator(final int code) { return mCurrentSettings.isWordSeparator(code); From 72b5daf03ddfe5d98c6ca8be9b6ae5bdd114a2c5 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 13 Nov 2012 15:18:28 +0900 Subject: [PATCH 3/3] Use hexadecimal constants for subtypeId Change-Id: I5ee7981f1d1d142c4d21d0257879e8e126860fa6 --- java/res/xml/method.xml | 110 ++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index ff8998ecf..9a2afccd2 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -87,161 +87,161 @@ android:isDefault="@bool/im_is_default">