aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-02-13 18:15:22 +0900
committerJean Chalard <jchalard@google.com>2014-02-13 18:41:54 +0900
commit2c48846903c3f706a197c76f9bdcfcc94ff907e8 (patch)
tree93c9803274fc8dde4e60a61c1b592f5519941c9b /java/src
parente0a425681c2902b463e57c55a4c4e9d6b3dc7311 (diff)
downloadlatinime-2c48846903c3f706a197c76f9bdcfcc94ff907e8.tar.gz
latinime-2c48846903c3f706a197c76f9bdcfcc94ff907e8.tar.xz
latinime-2c48846903c3f706a197c76f9bdcfcc94ff907e8.zip
Backward compatibility hack : send delete when empty.
Some apps depend on the keyboard sending something to them when the text is empty. This is BROKEN. Your app must not lie to the keyboard about what is before the cursor. If there is something to delete, you must not pretend there is not and try to catch some delete event. This will result in a bad user experience. This will not work with all IMEs. If your app needs this broken behavior, you're doing it wrong. Seriously guys, we're not in the era of typewriters any more, there are touch screens, there are gestures, there is accessibility, there are many innovative IMEs that don't have keys. Do *NOT* rely on key events. This change implements an ugly hack so that these broken apps may continue half-working with LatinIME. We are very unhappy about this. Bug: 12998568 Change-Id: Ia62ae2fbee4fee65b463acf3a79aafcfd0defa1d
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 7d6156959..bd114ebca 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -973,7 +973,13 @@ public final class InputLogic {
} else {
final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor();
if (codePointBeforeCursor == Constants.NOT_A_CODE) {
- // Nothing to delete before the cursor.
+ // HACK for backward compatibility with broken apps that haven't realized
+ // yet that hardware keyboards are not the only way of inputting text.
+ // Nothing to delete before the cursor. We should not do anything, but many
+ // broken apps expect something to happen in this case so that they can
+ // catch it and have their broken interface react. If you need the keyboard
+ // to do this, you're doing it wrong -- please fix your app.
+ mConnection.deleteSurroundingText(1, 0);
return;
}
final int lengthToDelete =