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: I3462082374fe9579bec7698f4d424de6ff5f2dedmain
parent
0856ceef9a
commit
5bde3a6163
|
@ -568,16 +568,11 @@ public final class RichInputConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final int cursor = getCursorPosition();
|
final String word = before.toString().substring(start, before.length())
|
||||||
if (start >= 0 && cursor + end <= after.length() + before.length()) {
|
|
||||||
String word = before.toString().substring(start, before.length())
|
|
||||||
+ after.toString().substring(0, end);
|
+ after.toString().substring(0, end);
|
||||||
return new Range(before.length() - start, end, word);
|
return new Range(before.length() - start, end, word);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCursorTouchingWord(final SettingsValues settingsValues) {
|
public boolean isCursorTouchingWord(final SettingsValues settingsValues) {
|
||||||
final CharSequence before = getTextBeforeCursor(1, 0);
|
final CharSequence before = getTextBeforeCursor(1, 0);
|
||||||
final CharSequence after = getTextAfterCursor(1, 0);
|
final CharSequence after = getTextAfterCursor(1, 0);
|
||||||
|
|
Loading…
Reference in New Issue