Extract fewer characters in getWordRangeAtCursor().

Use LOOKBACK_CHARACTER_NUM = 80 instead of the previous
EDITOR_CONTENTS_CACHE_SIZE = 1024 (which was overkill).

This speeds up many InputLogic operations.

Bug: 19987461
Change-Id: I62b6a589f87e5daab33376b3e48f1c615a66dcfb
main
Tom Ouyang 2015-04-09 11:14:07 -07:00
parent 7f386acdd1
commit 3952078a91
1 changed files with 2 additions and 2 deletions

View File

@ -619,9 +619,9 @@ public final class RichInputConnection implements PrivateCommandPerformer {
if (!isConnected()) {
return null;
}
final CharSequence before = mIC.getTextBeforeCursor(Constants.EDITOR_CONTENTS_CACHE_SIZE,
final CharSequence before = mIC.getTextBeforeCursor(LOOKBACK_CHARACTER_NUM,
InputConnection.GET_TEXT_WITH_STYLES);
final CharSequence after = mIC.getTextAfterCursor(Constants.EDITOR_CONTENTS_CACHE_SIZE,
final CharSequence after = mIC.getTextAfterCursor(LOOKBACK_CHARACTER_NUM,
InputConnection.GET_TEXT_WITH_STYLES);
if (before == null || after == null) {
return null;