From 3952078a919caf9a44d271642122c413dbd487f9 Mon Sep 17 00:00:00 2001 From: Tom Ouyang Date: Thu, 9 Apr 2015 11:14:07 -0700 Subject: [PATCH] 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 --- .../com/android/inputmethod/latin/RichInputConnection.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 6409ed82f..49c47d775 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -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;