diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 5 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/SettingsValues.java | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index b02aec832..59de798d8 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1208,7 +1208,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // swap it, and override the space state with SPACESTATE_SWAP_PUNCTUATION. // To swap it, we fool handleSeparator to think the previous space state was a // magic space. - if (Keyboard.CODE_SPACE == toLeft && mSpaceState == SPACE_STATE_WEAK) { + if (Keyboard.CODE_SPACE == toLeft && mSpaceState == SPACE_STATE_WEAK + && mSettingsValues.isMagicSpaceSwapper(code)) { mSpaceState = SPACE_STATE_MAGIC; shouldRegisterSwapPunctuation = true; } else { @@ -2186,7 +2187,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // enter surrogate pairs this code will have been removed. if (Keyboard.CODE_SPACE != textBeforeCursor.charAt(1)) { // We should not have come here if the text before the cursor is not a space. - throw new RuntimeException("Tried to revert a swap of punctiation but we didn't " + throw new RuntimeException("Tried to revert a swap of punctuation but we didn't " + "find a space just before the cursor."); } ic.beginBatchEdit(); diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java index 651d90ca4..83b27f7fe 100644 --- a/java/src/com/android/inputmethod/latin/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/SettingsValues.java @@ -91,6 +91,14 @@ public class SettingsValues { mDelayUpdateOldSuggestions = res.getInteger(R.integer.config_delay_update_old_suggestions); mMagicSpaceStrippers = res.getString(R.string.magic_space_stripping_symbols); mMagicSpaceSwappers = res.getString(R.string.magic_space_swapping_symbols); + if (LatinImeLogger.sDBG) { + for (int i = 0; i < mMagicSpaceStrippers.length(); ++i) { + if (isMagicSpaceSwapper(mMagicSpaceStrippers.codePointAt(i))) { + throw new RuntimeException("Char code " + mMagicSpaceStrippers.codePointAt(i) + + " is both a magic space swapper and stripper."); + } + } + } mSuggestPuncs = res.getString(R.string.suggested_punctuations); // TODO: it would be nice not to recreate this each time we change the configuration mSuggestPuncList = createSuggestPuncList(mSuggestPuncs); |