aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java8
-rw-r--r--tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java10
2 files changed, 12 insertions, 6 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 =
diff --git a/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java b/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java
index 82bf0d480..6e894decf 100644
--- a/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java
+++ b/tests/src/com/android/inputmethod/latin/BlueUnderlineTests.java
@@ -50,8 +50,7 @@ public class BlueUnderlineTests extends InputTestsBase {
final SpanGetter spanBefore = new SpanGetter(mEditText.getText(), SuggestionSpan.class);
assertEquals("extend blue underline, span start", EXPECTED_SPAN_START, spanBefore.mStart);
assertEquals("extend blue underline, span end", EXPECTED_SPAN_END, spanBefore.mEnd);
- assertEquals("extend blue underline, span color", true,
- spanBefore.isAutoCorrectionIndicator());
+ assertTrue("extend blue underline, span color", spanBefore.isAutoCorrectionIndicator());
sleep(DELAY_TO_WAIT_FOR_UNDERLINE);
runMessages();
// Now we have been able to re-evaluate the word, there shouldn't be an auto-correction span
@@ -80,8 +79,8 @@ public class BlueUnderlineTests extends InputTestsBase {
sleep(DELAY_TO_WAIT_FOR_UNDERLINE);
runMessages();
final SpanGetter suggestionSpan = new SpanGetter(mEditText.getText(), SuggestionSpan.class);
- assertFalse("show no blue underline after backspace, span start should be -1",
- suggestionSpan.isAutoCorrectionIndicator());
+ assertFalse("show no blue underline after backspace, span should not be the auto-"
+ + "correction indicator", suggestionSpan.isAutoCorrectionIndicator());
final SpanGetter underlineSpan = new SpanGetter(mEditText.getText(), UnderlineSpan.class);
assertEquals("should be composing, so should have an underline span",
EXPECTED_UNDERLINE_SPAN_START, underlineSpan.mStart);
@@ -107,7 +106,8 @@ public class BlueUnderlineTests extends InputTestsBase {
sleep(DELAY_TO_WAIT_FOR_UNDERLINE);
runMessages();
final SpanGetter span = new SpanGetter(mEditText.getText(), SuggestionSpan.class);
- assertNull("blue underline removed when cursor is moved", span.mSpan);
+ assertFalse("blue underline removed when cursor is moved",
+ span.isAutoCorrectionIndicator());
}
public void testComposingStopsOnSpace() {