Don't put spaces after characters that don't take one

Bug: 7393639
Change-Id: I1245a7b5077e554642838d6856ce269ca7f91988
main
Jean Chalard 2012-10-23 11:30:39 +09:00
parent 65225d8211
commit f960eb186d
2 changed files with 7 additions and 1 deletions

View File

@ -1431,8 +1431,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mSpaceState = SPACE_STATE_PHANTOM;
} else {
final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor();
// TODO: reverse this logic. We should have the means to determine whether a character
// should usually be followed by a space, and it should be more readable.
if (Constants.NOT_A_CODE != codePointBeforeCursor
&& !Character.isWhitespace(codePointBeforeCursor)) {
&& !Character.isWhitespace(codePointBeforeCursor)
&& !mCurrentSettings.isPhantomSpacePromotingSymbol(codePointBeforeCursor)
&& !mCurrentSettings.isWeakSpaceStripper(codePointBeforeCursor)) {
mSpaceState = SPACE_STATE_PHANTOM;
}
}

View File

@ -254,11 +254,13 @@ public final class SettingsValues {
return mSymbolsExcludedFromWordSeparators.contains(String.valueOf((char)code));
}
// TODO: use "Phantom" instead of "Weak" in this method name
public boolean isWeakSpaceStripper(final int code) {
// TODO: this does not work if the code does not fit in a char
return mWeakSpaceStrippers.contains(String.valueOf((char)code));
}
// TODO: use "Phantom" instead of "Weak" in this method name
public boolean isWeakSpaceSwapper(final int code) {
// TODO: this does not work if the code does not fit in a char
return mWeakSpaceSwappers.contains(String.valueOf((char)code));