From 6cf843cba6faeef674101a762bfed3ae9dce0a3c Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 20 Dec 2013 16:00:26 +0900 Subject: [PATCH] [IL23] Resolve a long-standing TODO. Bug: 8636060 Change-Id: I3a840c30cc4489debf9118beeec448488503bc1c --- .../android/inputmethod/latin/inputlogic/InputLogic.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index fd44dde85..b9c96555b 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -1131,10 +1131,9 @@ public final class InputLogic { // We have a TLD (or something that looks like this): make sure we don't add // a space even if currently in phantom mode. mSpaceState = SpaceState.NONE; - // TODO: use getCodePointBeforeCursor instead to improve performance and simplify the code - final CharSequence lastOne = mConnection.getTextBeforeCursor(1, 0); - if (lastOne != null && lastOne.length() == 1 - && lastOne.charAt(0) == Constants.CODE_PERIOD) { + final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor(); + // If no code point, #getCodePointBeforeCursor returns NOT_A_CODE_POINT. + if (Constants.CODE_PERIOD == codePointBeforeCursor) { return text.substring(1); } else { return text;