diff options
author | 2011-12-13 05:48:27 -0800 | |
---|---|---|
committer | 2011-12-13 05:48:27 -0800 | |
commit | 42eee3cac911134721ac9d8e3f0677854a8d0293 (patch) | |
tree | a533f6c34bd186f14f70e6bf2aa3d4385d947521 /java/src | |
parent | 8a4d4de0eb38b23c23241ad96767bb312ae3281f (diff) | |
parent | 7e6f4daa196f0fd88873b5b360e3fc11b97e1ef7 (diff) | |
download | latinime-42eee3cac911134721ac9d8e3f0677854a8d0293.tar.gz latinime-42eee3cac911134721ac9d8e3f0677854a8d0293.tar.xz latinime-42eee3cac911134721ac9d8e3f0677854a8d0293.zip |
am 7e6f4daa: Merge "Tighten conditions for space-related cancelling"
* commit '7e6f4daa196f0fd88873b5b360e3fc11b97e1ef7':
Tighten conditions for space-related cancelling
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index eae983786..a8f4e3179 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2225,8 +2225,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // Here we test whether we indeed have a period and a space before us. This should not // be needed, but it's there just in case something went wrong. final CharSequence textBeforeCursor = ic.getTextBeforeCursor(2, 0); - if (!". ".equals(textBeforeCursor)) - return false; + if (!". ".equals(textBeforeCursor)) { + // We should not have come here if we aren't just after a ". ". + throw new RuntimeException("Tried to revert double-space combo but we didn't find " + + "\". \" just before the cursor."); + } ic.beginBatchEdit(); ic.deleteSurroundingText(2, 0); ic.commitText(" ", 1); @@ -2240,8 +2243,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final CharSequence textBeforeCursor = ic.getTextBeforeCursor(2, 0); // NOTE: This does not work with surrogate pairs. Hopefully when the keyboard is able to // enter surrogate pairs this code will have been removed. - if (Keyboard.CODE_SPACE != textBeforeCursor.charAt(1)) - return false; + 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 " + + "find a space just before the cursor."); + } ic.beginBatchEdit(); ic.deleteSurroundingText(2, 0); ic.commitText(" " + textBeforeCursor.subSequence(0, 1), 1); |