am 5bde3a61: Fix an old bug in getting a word from the connected view.

* commit '5bde3a61633556afb16481680daefc7cabbf5890':
  Fix an old bug in getting a word from the connected view.
This commit is contained in:
Jean Chalard 2012-12-26 22:52:03 -08:00 committed by Android Git Automerger
commit 0da5d0d600

View file

@ -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);