mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix a bug where quotes and dashes are considered letters
Bug: 6174065 Change-Id: I702760d44ead0eeb60d06360aa3bb03c2ec73325
This commit is contained in:
parent
2be7a37acf
commit
6ec1209a33
@ -2059,10 +2059,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
|||||||
if (ic == null) return false;
|
if (ic == null) return false;
|
||||||
CharSequence before = ic.getTextBeforeCursor(1, 0);
|
CharSequence before = ic.getTextBeforeCursor(1, 0);
|
||||||
CharSequence after = ic.getTextAfterCursor(1, 0);
|
CharSequence after = ic.getTextAfterCursor(1, 0);
|
||||||
if (!TextUtils.isEmpty(before) && !mSettingsValues.isWordSeparator(before.charAt(0))) {
|
if (!TextUtils.isEmpty(before) && !mSettingsValues.isWordSeparator(before.charAt(0))
|
||||||
|
&& !mSettingsValues.isSymbolExcludedFromWordSeparators(before.charAt(0))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(after) && !mSettingsValues.isWordSeparator(after.charAt(0))) {
|
if (!TextUtils.isEmpty(after) && !mSettingsValues.isWordSeparator(after.charAt(0))
|
||||||
|
&& !mSettingsValues.isSymbolExcludedFromWordSeparators(after.charAt(0))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -554,6 +554,22 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
|
|||||||
EXPECTED_RESULT, mTextView.getText().toString());
|
EXPECTED_RESULT, mTextView.getText().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAutoCorrectionWithSingleQuoteInside() {
|
||||||
|
final String WORD_TO_TYPE = "you'f ";
|
||||||
|
final String EXPECTED_RESULT = "you'd ";
|
||||||
|
type(WORD_TO_TYPE);
|
||||||
|
assertEquals("auto-correction with single quote inside",
|
||||||
|
EXPECTED_RESULT, mTextView.getText().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAutoCorrectionWithSingleQuotesAround() {
|
||||||
|
final String WORD_TO_TYPE = "'tgis' ";
|
||||||
|
final String EXPECTED_RESULT = "'this' ";
|
||||||
|
type(WORD_TO_TYPE);
|
||||||
|
assertEquals("auto-correction with single quotes around",
|
||||||
|
EXPECTED_RESULT, mTextView.getText().toString());
|
||||||
|
}
|
||||||
|
|
||||||
// A helper class to ease span tests
|
// A helper class to ease span tests
|
||||||
private static class Span {
|
private static class Span {
|
||||||
final SpannableStringBuilder mInputText;
|
final SpannableStringBuilder mInputText;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user