Canceled auto-completion shouldn't be re-auto-completed
bug: 2847211 Change-Id: I2185fcf6b798a41135c329485914bc035fad5119main
parent
889691eca1
commit
c1e2e827b5
|
@ -231,7 +231,7 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
// Indicates whether the suggestion strip is to be on in landscape
|
// Indicates whether the suggestion strip is to be on in landscape
|
||||||
private boolean mJustAccepted;
|
private boolean mJustAccepted;
|
||||||
private CharSequence mJustRevertedSeparator;
|
private boolean mJustReverted;
|
||||||
private int mDeleteCount;
|
private int mDeleteCount;
|
||||||
private long mLastKeyTime;
|
private long mLastKeyTime;
|
||||||
|
|
||||||
|
@ -860,8 +860,7 @@ public class LatinIME extends InputMethodService
|
||||||
// Don't look for corrections if the keyboard is not visible
|
// Don't look for corrections if the keyboard is not visible
|
||||||
if (mKeyboardSwitcher.isInputViewShown()) {
|
if (mKeyboardSwitcher.isInputViewShown()) {
|
||||||
// Check if we should go in or out of correction mode.
|
// Check if we should go in or out of correction mode.
|
||||||
if (isPredictionOn()
|
if (isPredictionOn() && !mJustReverted
|
||||||
&& mJustRevertedSeparator == null
|
|
||||||
&& (candidatesStart == candidatesEnd || newSelStart != oldSelStart
|
&& (candidatesStart == candidatesEnd || newSelStart != oldSelStart
|
||||||
|| TextEntryState.isCorrecting())
|
|| TextEntryState.isCorrecting())
|
||||||
&& (newSelStart < newSelEnd - 1 || (!mPredicting))
|
&& (newSelStart < newSelEnd - 1 || (!mPredicting))
|
||||||
|
@ -1287,7 +1286,7 @@ public class LatinIME extends InputMethodService
|
||||||
handleCharacter(primaryCode, keyCodes);
|
handleCharacter(primaryCode, keyCodes);
|
||||||
}
|
}
|
||||||
// Cancel the just reverted state
|
// Cancel the just reverted state
|
||||||
mJustRevertedSeparator = null;
|
mJustReverted = false;
|
||||||
}
|
}
|
||||||
if (mKeyboardSwitcher.onKey(primaryCode)) {
|
if (mKeyboardSwitcher.onKey(primaryCode)) {
|
||||||
changeKeyboardMode();
|
changeKeyboardMode();
|
||||||
|
@ -1311,7 +1310,7 @@ public class LatinIME extends InputMethodService
|
||||||
ic.commitText(text, 1);
|
ic.commitText(text, 1);
|
||||||
ic.endBatchEdit();
|
ic.endBatchEdit();
|
||||||
updateShiftKeyState(getCurrentInputEditorInfo());
|
updateShiftKeyState(getCurrentInputEditorInfo());
|
||||||
mJustRevertedSeparator = null;
|
mJustReverted = false;
|
||||||
mJustAddedAutoSpace = false;
|
mJustAddedAutoSpace = false;
|
||||||
mEnteredText = text;
|
mEnteredText = text;
|
||||||
}
|
}
|
||||||
|
@ -1386,7 +1385,7 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mJustRevertedSeparator = null;
|
mJustReverted = false;
|
||||||
ic.endBatchEdit();
|
ic.endBatchEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1532,10 +1531,7 @@ public class LatinIME extends InputMethodService
|
||||||
// not to auto correct, but accept the typed word. For instance,
|
// not to auto correct, but accept the typed word. For instance,
|
||||||
// in Italian dov' should not be expanded to dove' because the elision
|
// in Italian dov' should not be expanded to dove' because the elision
|
||||||
// requires the last vowel to be removed.
|
// requires the last vowel to be removed.
|
||||||
if (mAutoCorrectOn && primaryCode != '\'' &&
|
if (mAutoCorrectOn && primaryCode != '\'' && !mJustReverted) {
|
||||||
(mJustRevertedSeparator == null
|
|
||||||
|| mJustRevertedSeparator.length() == 0
|
|
||||||
|| mJustRevertedSeparator.charAt(0) != primaryCode)) {
|
|
||||||
pickedDefault = pickDefaultSuggestion();
|
pickedDefault = pickDefaultSuggestion();
|
||||||
// Picked the suggestion by the space key. We consider this
|
// Picked the suggestion by the space key. We consider this
|
||||||
// as "added an auto space".
|
// as "added an auto space".
|
||||||
|
@ -2235,7 +2231,7 @@ public class LatinIME extends InputMethodService
|
||||||
if (!mPredicting && length > 0) {
|
if (!mPredicting && length > 0) {
|
||||||
final InputConnection ic = getCurrentInputConnection();
|
final InputConnection ic = getCurrentInputConnection();
|
||||||
mPredicting = true;
|
mPredicting = true;
|
||||||
mJustRevertedSeparator = ic.getTextBeforeCursor(1, 0);
|
mJustReverted = true;
|
||||||
if (deleteChar) ic.deleteSurroundingText(1, 0);
|
if (deleteChar) ic.deleteSurroundingText(1, 0);
|
||||||
int toDelete = mCommittedLength;
|
int toDelete = mCommittedLength;
|
||||||
CharSequence toTheLeft = ic.getTextBeforeCursor(mCommittedLength, 0);
|
CharSequence toTheLeft = ic.getTextBeforeCursor(mCommittedLength, 0);
|
||||||
|
@ -2249,7 +2245,7 @@ public class LatinIME extends InputMethodService
|
||||||
mHandler.postUpdateSuggestions();
|
mHandler.postUpdateSuggestions();
|
||||||
} else {
|
} else {
|
||||||
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
sendDownUpKeyEvents(KeyEvent.KEYCODE_DEL);
|
||||||
mJustRevertedSeparator = null;
|
mJustReverted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue