From 6d78302155d8a6437ab6541d93ddb42bf21e0a61 Mon Sep 17 00:00:00 2001
From: satok <satok@google.com>
Date: Fri, 19 Aug 2011 18:22:28 +0900
Subject: [PATCH] Fix last excessive char correction handling

Change-Id: Id1d46cd96e041fbbbee995093ef8ca56daa3b383
---
 native/src/correction.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/native/src/correction.cpp b/native/src/correction.cpp
index d366d254b8..fb160149d7 100644
--- a/native/src/correction.cpp
+++ b/native/src/correction.cpp
@@ -212,6 +212,12 @@ Correction::CorrectionType Correction::processCharAndCalcState(
         const int32_t c, const bool isTerminal) {
 
     if (mNeedsToTraverseAllNodes || isQuote(c)) {
+        if (mLastCharExceeded > 0 && mInputIndex == mInputLength - 1
+                && mProximityInfo->getMatchedProximityId(mInputIndex, c, false)
+                        == ProximityInfo::SAME_OR_ACCENTED_OR_CAPITALIZED_CHAR) {
+            mLastCharExceeded = false;
+            --mExcessiveCount;
+        }
         return processSkipChar(c, isTerminal);
     }
 
@@ -312,7 +318,6 @@ Correction::CorrectionType Correction::processCharAndCalcState(
             && mExcessivePos >= 0 && (mInputIndex == mInputLength - 2);
     const bool isSameAsUserTypedLength = (mInputLength == mInputIndex + 1) || mLastCharExceeded;
     if (mLastCharExceeded) {
-        // TODO: Decrement mExcessiveCount if next char is matched word.
         ++mExcessiveCount;
     }
 
-- 
GitLab