aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Ouyang <ouyang@google.com>2012-09-04 22:54:33 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-09-04 22:54:33 -0700
commit2d15f11e2531f03dd970b2d492e17e5d15777cd8 (patch)
treeb63995c2ea6589af37f7f152ee86c7a27af0b5b4
parent7f7335d39bfb26a915f5c591765646f69670a023 (diff)
parent8c220a0aa2c5139a3b12af20e68c420f6402294a (diff)
downloadlatinime-2d15f11e2531f03dd970b2d492e17e5d15777cd8.tar.gz
latinime-2d15f11e2531f03dd970b2d492e17e5d15777cd8.tar.xz
latinime-2d15f11e2531f03dd970b2d492e17e5d15777cd8.zip
am 8c220a0a: Fix bug that can cause unexpected off-keyboard chars to appear as suggestions.
* commit '8c220a0aa2c5139a3b12af20e68c420f6402294a': Fix bug that can cause unexpected off-keyboard chars to appear as suggestions.
-rw-r--r--native/jni/src/proximity_info_state.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp
index c9a1ed0c0..4c67ea81c 100644
--- a/native/jni/src/proximity_info_state.cpp
+++ b/native/jni/src/proximity_info_state.cpp
@@ -391,11 +391,12 @@ int ProximityInfoState::getDuration(const int index) const {
float ProximityInfoState::getPointToKeyLength(int inputIndex, int codePoint, float scale) {
const int keyId = mProximityInfo->getKeyIndexOf(codePoint);
- if (keyId >= 0) {
+ if (keyId != NOT_AN_INDEX) {
const int index = inputIndex * mProximityInfo->getKeyCount() + keyId;
return min(mDistanceCache[index] * scale, mMaxPointToKeyLength);
}
- return 0;
+ // If the char is not a key on the keyboard then return the max length.
+ return MAX_POINT_TO_KEY_LENGTH;
}
int ProximityInfoState::getKeyKeyDistance(int key0, int key1) {