mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Cleanup (A57)
We stopped cancelling manual picks a few weeks ago. This code is dead. Change-Id: I4032fcc3c95e9379f1839fe860a1b8a9bd7d0bc7
This commit is contained in:
parent
29eeef75ec
commit
0e9e7e337d
@ -73,10 +73,10 @@ public class LastComposedWord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRevertCommit() {
|
public boolean canRevertCommit() {
|
||||||
return mActive && !TextUtils.isEmpty(mCommittedWord);
|
return mActive && !TextUtils.isEmpty(mCommittedWord) && !didCommitTypedWord();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean didCommitTypedWord() {
|
private boolean didCommitTypedWord() {
|
||||||
return TextUtils.equals(mTypedWord, mCommittedWord);
|
return TextUtils.equals(mTypedWord, mCommittedWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2000,23 +2000,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||||||
mUserHistoryDictionary.cancelAddingUserHistory(
|
mUserHistoryDictionary.cancelAddingUserHistory(
|
||||||
previousWord.toString(), committedWord.toString());
|
previousWord.toString(), committedWord.toString());
|
||||||
}
|
}
|
||||||
if (0 == separatorLength || mLastComposedWord.didCommitTypedWord()) {
|
mConnection.commitText(originallyTypedWord, 1);
|
||||||
// This is the case when we cancel a manual pick.
|
// Re-insert the separator
|
||||||
// We should restart suggestion on the word right away.
|
sendKeyCodePoint(mLastComposedWord.mSeparatorCode);
|
||||||
mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
|
Utils.Stats.onSeparator(mLastComposedWord.mSeparatorCode, WordComposer.NOT_A_COORDINATE,
|
||||||
mConnection.setComposingText(originallyTypedWord, 1);
|
WordComposer.NOT_A_COORDINATE);
|
||||||
} else {
|
if (ProductionFlag.IS_EXPERIMENTAL) {
|
||||||
mConnection.commitText(originallyTypedWord, 1);
|
ResearchLogger.latinIME_revertCommit(originallyTypedWord);
|
||||||
// Re-insert the separator
|
|
||||||
sendKeyCodePoint(mLastComposedWord.mSeparatorCode);
|
|
||||||
Utils.Stats.onSeparator(mLastComposedWord.mSeparatorCode, WordComposer.NOT_A_COORDINATE,
|
|
||||||
WordComposer.NOT_A_COORDINATE);
|
|
||||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
|
||||||
ResearchLogger.latinIME_revertCommit(originallyTypedWord);
|
|
||||||
}
|
|
||||||
// Don't restart suggestion yet. We'll restart if the user deletes the
|
|
||||||
// separator.
|
|
||||||
}
|
}
|
||||||
|
// Don't restart suggestion yet. We'll restart if the user deletes the
|
||||||
|
// separator.
|
||||||
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
|
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
|
||||||
mHandler.postUpdateSuggestions();
|
mHandler.postUpdateSuggestions();
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,26 @@ public class InputLogicTests extends InputTestsBase {
|
|||||||
mTextView.getText().toString());
|
mTextView.getText().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAutoCorrectWithSpaceThenRevert() {
|
||||||
|
final String STRING_TO_TYPE = "tgis ";
|
||||||
|
final String EXPECTED_RESULT = "tgis ";
|
||||||
|
type(STRING_TO_TYPE);
|
||||||
|
mLatinIME.onUpdateSelection(0, 0, STRING_TO_TYPE.length(), STRING_TO_TYPE.length(), -1, -1);
|
||||||
|
type(Keyboard.CODE_DELETE);
|
||||||
|
assertEquals("auto-correct with space then revert", EXPECTED_RESULT,
|
||||||
|
mTextView.getText().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAutoCorrectToSelfDoesNotRevert() {
|
||||||
|
final String STRING_TO_TYPE = "this ";
|
||||||
|
final String EXPECTED_RESULT = "this";
|
||||||
|
type(STRING_TO_TYPE);
|
||||||
|
mLatinIME.onUpdateSelection(0, 0, STRING_TO_TYPE.length(), STRING_TO_TYPE.length(), -1, -1);
|
||||||
|
type(Keyboard.CODE_DELETE);
|
||||||
|
assertEquals("auto-correct with space does not revert", EXPECTED_RESULT,
|
||||||
|
mTextView.getText().toString());
|
||||||
|
}
|
||||||
|
|
||||||
public void testDoubleSpace() {
|
public void testDoubleSpace() {
|
||||||
final String STRING_TO_TYPE = "this ";
|
final String STRING_TO_TYPE = "this ";
|
||||||
final String EXPECTED_RESULT = "this. ";
|
final String EXPECTED_RESULT = "this. ";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user