aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-06-08 21:50:34 +0900
committerJean Chalard <jchalard@google.com>2012-06-12 10:29:55 +0900
commita32eb2721390d5964c83c787ad30fd3f61b936b0 (patch)
tree4d9544126af9c26886930172d02b8fa53cdc8664 /java/src/com/android/inputmethod/latin/RichInputConnection.java
parent243e370fcb1c2cb8608614206075ecdbe79a6372 (diff)
downloadlatinime-a32eb2721390d5964c83c787ad30fd3f61b936b0.tar.gz
latinime-a32eb2721390d5964c83c787ad30fd3f61b936b0.tar.xz
latinime-a32eb2721390d5964c83c787ad30fd3f61b936b0.zip
Move an editing method to the RichInputConnection
Change-Id: Ie143ad008ca8deb1c5034cb80ec1cb28a6b0682d
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index 6f5d91a94..5ca4a84b9 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -370,4 +370,27 @@ public class RichInputConnection {
return word;
}
+
+ public boolean revertDoubleSpace() {
+ // 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 = getTextBeforeCursor(2, 0);
+ if (!". ".equals(textBeforeCursor)) {
+ // Theoretically we should not be coming here if there isn't ". " before the
+ // cursor, but the application may be changing the text while we are typing, so
+ // anything goes. We should not crash.
+ Log.d(TAG, "Tried to revert double-space combo but we didn't find "
+ + "\". \" just before the cursor.");
+ return false;
+ }
+ deleteSurroundingText(2, 0);
+ if (ProductionFlag.IS_EXPERIMENTAL) {
+ ResearchLogger.latinIME_deleteSurroundingText(2);
+ }
+ commitText(" ", 1);
+ if (ProductionFlag.IS_EXPERIMENTAL) {
+ ResearchLogger.latinIME_revertDoubleSpaceWhileInBatchEdit();
+ }
+ return true;
+ }
}