From ef0498a8cc8f0bf1ae7796b99e12827d2982c8ca Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Fri, 4 Apr 2014 18:25:34 +0000 Subject: [PATCH] Revert "[CB22] Merge add and delete" This reverts commit f6bce235ae4cb4dc366dbfa534e26ad416b14e6b. Seeing several new unit test failures after this CL. Reverting.. Change-Id: Ie97127550ee36dd4a07a36701e9c5118684dfbc5 --- .../inputmethod/latin/WordComposer.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 5d21554ae..87cf64461 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -169,7 +169,26 @@ public final class WordComposer { * coordinates. */ public void add(final Event event) { + final int primaryCode = event.mCodePoint; + final int keyX = event.mX; + final int keyY = event.mY; + final int newIndex = size(); processEvent(event); + if (newIndex < MAX_WORD_LENGTH) { + mPrimaryKeyCodes[newIndex] = primaryCode >= Constants.CODE_SPACE + ? Character.toLowerCase(primaryCode) : primaryCode; + // In the batch input mode, the {@code mInputPointers} holds batch input points and + // shouldn't be overridden by the "typed key" coordinates + // (See {@link #setBatchInputWord}). + if (!mIsBatchMode) { + // TODO: Set correct pointer id and time + mInputPointers.addPointerAt(newIndex, keyX, keyY, 0, 0); + } + } + mIsFirstCharCapitalized = isFirstCharCapitalized( + newIndex, primaryCode, mIsFirstCharCapitalized); + if (Character.isUpperCase(primaryCode)) mCapsCount++; + if (Character.isDigit(primaryCode)) mDigitsCount++; } private void processEvent(final Event event) { @@ -204,19 +223,6 @@ public final class WordComposer { } else { mTrailingSingleQuotesCount = 0; } - if (newIndex < MAX_WORD_LENGTH) { - // In the batch input mode, the {@code mInputPointers} holds batch input points and - // shouldn't be overridden by the "typed key" coordinates - // (See {@link #setBatchInputWord}). - if (!mIsBatchMode) { - // TODO: Set correct pointer id and time - mInputPointers.addPointerAt(newIndex, keyX, keyY, 0, 0); - } - } - mIsFirstCharCapitalized = isFirstCharCapitalized( - newIndex, primaryCode, mIsFirstCharCapitalized); - if (Character.isUpperCase(primaryCode)) mCapsCount++; - if (Character.isDigit(primaryCode)) mDigitsCount++; } mAutoCorrection = null; }