From dfaeb125eb27172e4d38e1e5a87a13a3320c1e82 Mon Sep 17 00:00:00 2001
From: Jean Chalard <jchalard@google.com>
Date: Tue, 25 Mar 2014 22:44:59 +0900
Subject: [PATCH] [CB20] Some more refactoring

Bug: 13406701
Change-Id: I4502658f4f1e1997d0ac245d95e2d4a1415b1861
---
 .../inputmethod/latin/WordComposer.java        | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index f31fb134c4..3f9d57e42f 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -174,7 +174,6 @@ public final class WordComposer {
         final int keyY = event.mY;
         final int newIndex = size();
         processEvent(event);
-        mCursorPositionWithinWord = mCodePointSize;
         if (newIndex < MAX_WORD_LENGTH) {
             mPrimaryKeyCodes[newIndex] = primaryCode >= Constants.CODE_SPACE
                     ? Character.toLowerCase(primaryCode) : primaryCode;
@@ -195,13 +194,22 @@ public final class WordComposer {
         } else {
             mTrailingSingleQuotesCount = 0;
         }
-        mAutoCorrection = null;
     }
 
     private void processEvent(final Event event) {
+        final int primaryCode = event.mCodePoint;
+        final int keyX = event.mX;
+        final int keyY = event.mY;
+        final int newIndex = size();
         mCombinerChain.processEvent(mEvents, event);
         mEvents.add(event);
         refreshTypedWordCache();
+        mCursorPositionWithinWord = mCodePointSize;
+        // We may have deleted the last one.
+        if (0 == mCodePointSize) {
+            mIsFirstCharCapitalized = false;
+        }
+        mAutoCorrection = null;
     }
 
     /**
@@ -209,10 +217,6 @@ public final class WordComposer {
      */
     public void deleteLast(final Event event) {
         processEvent(event);
-        // We may have deleted the last one.
-        if (0 == size()) {
-            mIsFirstCharCapitalized = false;
-        }
         if (mTrailingSingleQuotesCount > 0) {
             --mTrailingSingleQuotesCount;
         } else {
@@ -225,8 +229,6 @@ public final class WordComposer {
                 ++mTrailingSingleQuotesCount;
             }
         }
-        mCursorPositionWithinWord = mCodePointSize;
-        mAutoCorrection = null;
     }
 
     public void setCursorPositionWithinWord(final int posWithinWord) {
-- 
GitLab