aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2012-11-13 20:08:59 +0900
committerKen Wakasa <kwakasa@google.com>2012-11-13 20:08:59 +0900
commit63531e14339bac6669f578dff6e9d03613792811 (patch)
tree7e085ca45a68465333a2d1a7934f11ae7ab92ecf /java/src
parent6d05505bbf4c48715124d554f47cf6b201fbab88 (diff)
parent80d7d32424dd856a2f55fea981a5a511a09d2ee9 (diff)
downloadlatinime-63531e14339bac6669f578dff6e9d03613792811.tar.gz
latinime-63531e14339bac6669f578dff6e9d03613792811.tar.xz
latinime-63531e14339bac6669f578dff6e9d03613792811.zip
Merge remote-tracking branch 'goog/master' into mergescriptpackage
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java39
1 files changed, 20 insertions, 19 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 3dfffc4a6..b680cb7fd 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -710,21 +710,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);
@@ -1411,7 +1407,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mHandler.postUpdateSuggestionStrip();
final String text = specificTldProcessingOnTextInput(rawText);
if (SPACE_STATE_PHANTOM == mSpaceState) {
- sendKeyCodePoint(Constants.CODE_SPACE);
+ promotePhantomSpace();
}
mConnection.commitText(text, 1);
mConnection.endBatchEdit();
@@ -1574,7 +1570,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mWordComposer.setBatchInputWord(batchInputText);
mConnection.beginBatchEdit();
if (SPACE_STATE_PHANTOM == mSpaceState) {
- sendKeyCodePoint(Constants.CODE_SPACE);
+ promotePhantomSpace();
}
mConnection.setComposingText(batchInputText, 1);
mExpectingUpdateSelection = true;
@@ -1729,7 +1725,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// Sanity check
throw new RuntimeException("Should not be composing here");
}
- sendKeyCodePoint(Constants.CODE_SPACE);
+ promotePhantomSpace();
}
// NOTE: isCursorTouchingWord() is a blocking IPC call, so it often takes several
@@ -1806,7 +1802,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
if (SPACE_STATE_PHANTOM == spaceState &&
mCurrentSettings.isPhantomSpacePromotingSymbol(primaryCode)) {
- sendKeyCodePoint(Constants.CODE_SPACE);
+ promotePhantomSpace();
}
sendKeyCodePoint(primaryCode);
@@ -2070,7 +2066,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
int firstChar = Character.codePointAt(suggestion, 0);
if ((!mCurrentSettings.isWeakSpaceStripper(firstChar))
&& (!mCurrentSettings.isWeakSpaceSwapper(firstChar))) {
- sendKeyCodePoint(Constants.CODE_SPACE);
+ promotePhantomSpace();
}
}
@@ -2247,6 +2243,11 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mHandler.postUpdateSuggestionStrip();
}
+ // This essentially inserts a space, and that's it.
+ public void promotePhantomSpace() {
+ sendKeyCodePoint(Constants.CODE_SPACE);
+ }
+
// Used by the RingCharBuffer
public boolean isWordSeparator(final int code) {
return mCurrentSettings.isWordSeparator(code);