diff --git a/native/src/proximity_info.cpp b/native/src/proximity_info.cpp
index 2bfb15d8cc9281a9e39266ca09423d40cebed8f0..2f5f81ccba8a28374aefc06a1ef6e7e3ac1f5b14 100644
--- a/native/src/proximity_info.cpp
+++ b/native/src/proximity_info.cpp
@@ -156,57 +156,59 @@ void ProximityInfo::calculateNearbyKeyCodes(
     int insertPos = 0;
     inputCodes[insertPos++] = primaryKey;
     const int startIndex = getStartIndexFromCoordinates(x, y);
-    for (int i = 0; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
-        const int32_t c = mProximityCharsArray[startIndex + i];
-        if (c < KEYCODE_SPACE || c == primaryKey) {
-            continue;
-        }
-        const int keyIndex = getKeyIndex(c);
-        const bool onKey = isOnKey(keyIndex, x, y);
-        const int distance = squaredDistanceToEdge(keyIndex, x, y);
-        if (onKey || distance < MOST_COMMON_KEY_WIDTH_SQUARE) {
-            inputCodes[insertPos++] = c;
-            if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
-                if (DEBUG_DICT) {
-                    assert(false);
+
+        for (int i = 0; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
+            const int32_t c = mProximityCharsArray[startIndex + i];
+            if (c < KEYCODE_SPACE || c == primaryKey) {
+                continue;
+            }
+            const int keyIndex = getKeyIndex(c);
+            const bool onKey = isOnKey(keyIndex, x, y);
+            const int distance = squaredDistanceToEdge(keyIndex, x, y);
+            if (onKey || distance < MOST_COMMON_KEY_WIDTH_SQUARE) {
+                inputCodes[insertPos++] = c;
+                if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
+                    if (DEBUG_DICT) {
+                        assert(false);
+                    }
+                    return;
                 }
-                return;
             }
         }
-    }
-    const int additionalProximitySize =
-            AdditionalProximityChars::getAdditionalCharsSize(&mLocaleStr, primaryKey);
-    if (additionalProximitySize > 0) {
-        inputCodes[insertPos++] = ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE;
-        if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
+        const int additionalProximitySize =
+                AdditionalProximityChars::getAdditionalCharsSize(&mLocaleStr, primaryKey);
+        if (additionalProximitySize > 0) {
+            inputCodes[insertPos++] = ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE;
+            if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
             if (DEBUG_DICT) {
                 assert(false);
             }
             return;
         }
 
-        const int32_t* additionalProximityChars =
-                AdditionalProximityChars::getAdditionalChars(&mLocaleStr, primaryKey);
-        for (int j = 0; j < additionalProximitySize; ++j) {
-            const int32_t ac = additionalProximityChars[j];
-            int k = 0;
-            for (; k < insertPos; ++k) {
-                if ((int)ac == inputCodes[k]) {
-                    break;
+            const int32_t* additionalProximityChars =
+                    AdditionalProximityChars::getAdditionalChars(&mLocaleStr, primaryKey);
+            for (int j = 0; j < additionalProximitySize; ++j) {
+                const int32_t ac = additionalProximityChars[j];
+                int k = 0;
+                for (; k < insertPos; ++k) {
+                    if ((int)ac == inputCodes[k]) {
+                        break;
+                    }
                 }
-            }
-            if (k < insertPos) {
-                continue;
-            }
-            inputCodes[insertPos++] = ac;
-            if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
-                if (DEBUG_DICT) {
-                    assert(false);
+                if (k < insertPos) {
+                    continue;
                 }
-                return;
+                inputCodes[insertPos++] = ac;
+                if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
+                    if (DEBUG_DICT) {
+                        assert(false);
+                    }
+                    return;
             }
         }
     }
+
     // Add a delimiter for the proximity characters
     for (int i = insertPos; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
         inputCodes[i] = NOT_A_CODE;