mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Merge "Fix a bug with successive manual picks"
This commit is contained in:
commit
dab392c6f4
@ -1922,6 +1922,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||||||
mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion,
|
mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion,
|
||||||
mSettingsValues.mWordSeparators);
|
mSettingsValues.mWordSeparators);
|
||||||
|
|
||||||
|
if (SPACE_STATE_PHANTOM == mSpaceState && suggestion.length() > 0) {
|
||||||
|
int firstChar = Character.codePointAt(suggestion, 0);
|
||||||
|
if ((!mSettingsValues.isWeakSpaceStripper(firstChar))
|
||||||
|
&& (!mSettingsValues.isWeakSpaceSwapper(firstChar))) {
|
||||||
|
sendKeyCodePoint(Keyboard.CODE_SPACE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mInputAttributes.mApplicationSpecifiedCompletionOn
|
if (mInputAttributes.mApplicationSpecifiedCompletionOn
|
||||||
&& mApplicationSpecifiedCompletions != null
|
&& mApplicationSpecifiedCompletions != null
|
||||||
&& index >= 0 && index < mApplicationSpecifiedCompletions.length) {
|
&& index >= 0 && index < mApplicationSpecifiedCompletions.length) {
|
||||||
|
@ -404,7 +404,32 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
|
|||||||
type(WORD1_TO_TYPE);
|
type(WORD1_TO_TYPE);
|
||||||
mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
|
mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
|
||||||
type(WORD2_TO_TYPE);
|
type(WORD2_TO_TYPE);
|
||||||
assertEquals("manual pick then space then type", WORD1_TO_TYPE + WORD2_TO_TYPE,
|
assertEquals("manual pick then space then type", EXPECTED_RESULT,
|
||||||
|
mTextView.getText().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testManualPickThenManualPick() {
|
||||||
|
final String WORD1_TO_TYPE = "this";
|
||||||
|
final String WORD2_TO_PICK = "is";
|
||||||
|
final String EXPECTED_RESULT = "this is";
|
||||||
|
type(WORD1_TO_TYPE);
|
||||||
|
mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
|
||||||
|
// Here we fake picking a word through bigram prediction. This test is taking
|
||||||
|
// advantage of the fact that Latin IME blindly trusts the caller of #pickSuggestionManually
|
||||||
|
// to actually pass the right string.
|
||||||
|
mLatinIME.pickSuggestionManually(1, WORD2_TO_PICK);
|
||||||
|
assertEquals("manual pick then manual pick", EXPECTED_RESULT,
|
||||||
|
mTextView.getText().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testManualPickThenManualPickWithPunctAtStart() {
|
||||||
|
final String WORD1_TO_TYPE = "this";
|
||||||
|
final String WORD2_TO_PICK = "!is";
|
||||||
|
final String EXPECTED_RESULT = "this!is";
|
||||||
|
type(WORD1_TO_TYPE);
|
||||||
|
mLatinIME.pickSuggestionManually(0, WORD1_TO_TYPE);
|
||||||
|
mLatinIME.pickSuggestionManually(1, WORD2_TO_PICK);
|
||||||
|
assertEquals("manual pick then manual pick a word with punct at start", EXPECTED_RESULT,
|
||||||
mTextView.getText().toString());
|
mTextView.getText().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user