aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/proximity_info_state.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'native/jni/src/proximity_info_state.cpp')
-rw-r--r--native/jni/src/proximity_info_state.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp
index c9a1ed0c0..b363dcc36 100644
--- a/native/jni/src/proximity_info_state.cpp
+++ b/native/jni/src/proximity_info_state.cpp
@@ -391,11 +391,17 @@ 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;
+ // TODO: Do not hardcode here
+ // No penalty to ' and -
+ if (codePoint == '\'' || codePoint == '-') {
+ 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) {