Fix a bug with negative coordinates, step 1
This breaks style guidelines but for some reason git diff gets so lost on this re-indent that it's better to do it like this Change-Id: Ie0a603eb0739704894a5adc25f9d527b37bdf151main
parent
2b5b6388d6
commit
88ec125cfc
|
@ -156,57 +156,59 @@ void ProximityInfo::calculateNearbyKeyCodes(
|
||||||
int insertPos = 0;
|
int insertPos = 0;
|
||||||
inputCodes[insertPos++] = primaryKey;
|
inputCodes[insertPos++] = primaryKey;
|
||||||
const int startIndex = getStartIndexFromCoordinates(x, y);
|
const int startIndex = getStartIndexFromCoordinates(x, y);
|
||||||
for (int i = 0; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
|
|
||||||
const int32_t c = mProximityCharsArray[startIndex + i];
|
for (int i = 0; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
|
||||||
if (c < KEYCODE_SPACE || c == primaryKey) {
|
const int32_t c = mProximityCharsArray[startIndex + i];
|
||||||
continue;
|
if (c < KEYCODE_SPACE || c == primaryKey) {
|
||||||
}
|
continue;
|
||||||
const int keyIndex = getKeyIndex(c);
|
}
|
||||||
const bool onKey = isOnKey(keyIndex, x, y);
|
const int keyIndex = getKeyIndex(c);
|
||||||
const int distance = squaredDistanceToEdge(keyIndex, x, y);
|
const bool onKey = isOnKey(keyIndex, x, y);
|
||||||
if (onKey || distance < MOST_COMMON_KEY_WIDTH_SQUARE) {
|
const int distance = squaredDistanceToEdge(keyIndex, x, y);
|
||||||
inputCodes[insertPos++] = c;
|
if (onKey || distance < MOST_COMMON_KEY_WIDTH_SQUARE) {
|
||||||
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
inputCodes[insertPos++] = c;
|
||||||
if (DEBUG_DICT) {
|
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
||||||
assert(false);
|
if (DEBUG_DICT) {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
const int additionalProximitySize =
|
||||||
const int additionalProximitySize =
|
AdditionalProximityChars::getAdditionalCharsSize(&mLocaleStr, primaryKey);
|
||||||
AdditionalProximityChars::getAdditionalCharsSize(&mLocaleStr, primaryKey);
|
if (additionalProximitySize > 0) {
|
||||||
if (additionalProximitySize > 0) {
|
inputCodes[insertPos++] = ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE;
|
||||||
inputCodes[insertPos++] = ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE;
|
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
||||||
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int32_t* additionalProximityChars =
|
const int32_t* additionalProximityChars =
|
||||||
AdditionalProximityChars::getAdditionalChars(&mLocaleStr, primaryKey);
|
AdditionalProximityChars::getAdditionalChars(&mLocaleStr, primaryKey);
|
||||||
for (int j = 0; j < additionalProximitySize; ++j) {
|
for (int j = 0; j < additionalProximitySize; ++j) {
|
||||||
const int32_t ac = additionalProximityChars[j];
|
const int32_t ac = additionalProximityChars[j];
|
||||||
int k = 0;
|
int k = 0;
|
||||||
for (; k < insertPos; ++k) {
|
for (; k < insertPos; ++k) {
|
||||||
if ((int)ac == inputCodes[k]) {
|
if ((int)ac == inputCodes[k]) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (k < insertPos) {
|
||||||
if (k < insertPos) {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
inputCodes[insertPos++] = ac;
|
|
||||||
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
|
||||||
if (DEBUG_DICT) {
|
|
||||||
assert(false);
|
|
||||||
}
|
}
|
||||||
return;
|
inputCodes[insertPos++] = ac;
|
||||||
|
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
||||||
|
if (DEBUG_DICT) {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a delimiter for the proximity characters
|
// Add a delimiter for the proximity characters
|
||||||
for (int i = insertPos; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
|
for (int i = insertPos; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
|
||||||
inputCodes[i] = NOT_A_CODE;
|
inputCodes[i] = NOT_A_CODE;
|
||||||
|
|
Loading…
Reference in New Issue