aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-12-27 15:17:27 +0900
committerJean Chalard <jchalard@google.com>2012-12-27 15:41:10 +0900
commit5bde3a61633556afb16481680daefc7cabbf5890 (patch)
tree78dcbb2c39e5659760605313232f159222ce3870 /java/src
parent0856ceef9add40f3dbaa81d33bf9994c7543cd17 (diff)
downloadlatinime-5bde3a61633556afb16481680daefc7cabbf5890.tar.gz
latinime-5bde3a61633556afb16481680daefc7cabbf5890.tar.xz
latinime-5bde3a61633556afb16481680daefc7cabbf5890.zip
Fix an old bug in getting a word from the connected view.
In this test, it's impossible that start < 0 so the test is useless. I'm not sure what the cursor test was for, but it's very old code, and it seems the assumption was either misled or doesn't hold any more: testing for the absolute cursor position against the length of the word against the cursor makes no sense. The net result of this was that when the cursor index got large enough, resuming suggestion would not work any more. Bug: 7586467 Change-Id: I3462082374fe9579bec7698f4d424de6ff5f2ded
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index fe4a25765..f126e7d2a 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -568,14 +568,9 @@ public final class RichInputConnection {
}
}
- final int cursor = getCursorPosition();
- if (start >= 0 && cursor + end <= after.length() + before.length()) {
- String word = before.toString().substring(start, before.length())
- + after.toString().substring(0, end);
- return new Range(before.length() - start, end, word);
- }
-
- return null;
+ final String word = before.toString().substring(start, before.length())
+ + after.toString().substring(0, end);
+ return new Range(before.length() - start, end, word);
}
public boolean isCursorTouchingWord(final SettingsValues settingsValues) {