aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 4cb60558c..59de798d8 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -850,6 +850,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|| newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart;
final boolean candidatesCleared = candidatesStart == -1 && candidatesEnd == -1;
if (!mExpectingUpdateSelection) {
+ // TAKE CARE: there is a race condition when we enter this test even when the user
+ // did not explicitly move the cursor. This happens when typing fast, where two keys
+ // turn this flag on in succession and both onUpdateSelection() calls arrive after
+ // the second one - the first call successfully avoids this test, but the second one
+ // enters. For the moment we rely on candidatesCleared to further reduce the impact.
if (SPACE_STATE_WEAK == mSpaceState) {
// Test for no WEAK_SPACE action because there is a race condition that may end up
// in coming here on a normal key press. We set this to NONE because after
@@ -869,6 +874,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mComposingStateManager.onFinishComposingText();
mVoiceProxy.setVoiceInputHighlighted(false);
} else if (!mWordComposer.isComposingWord()) {
+ mWordComposer.reset();
updateSuggestions();
}
}
@@ -1202,7 +1208,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// swap it, and override the space state with SPACESTATE_SWAP_PUNCTUATION.
// To swap it, we fool handleSeparator to think the previous space state was a
// magic space.
- if (Keyboard.CODE_SPACE == toLeft && mSpaceState == SPACE_STATE_WEAK) {
+ if (Keyboard.CODE_SPACE == toLeft && mSpaceState == SPACE_STATE_WEAK
+ && mSettingsValues.isMagicSpaceSwapper(code)) {
mSpaceState = SPACE_STATE_MAGIC;
shouldRegisterSwapPunctuation = true;
} else {
@@ -2180,7 +2187,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// enter surrogate pairs this code will have been removed.
if (Keyboard.CODE_SPACE != textBeforeCursor.charAt(1)) {
// We should not have come here if the text before the cursor is not a space.
- throw new RuntimeException("Tried to revert a swap of punctiation but we didn't "
+ throw new RuntimeException("Tried to revert a swap of punctuation but we didn't "
+ "find a space just before the cursor.");
}
ic.beginBatchEdit();