aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/proximity_info.cpp
diff options
context:
space:
mode:
authorsatok <satok@google.com>2012-01-31 17:15:43 +0900
committersatok <satok@google.com>2012-02-02 16:07:16 +0900
commite05b3f4b3a57dcf99ade35bfbc1e1cdc3c3e476c (patch)
treef84b7084220c6f08f6b825655d1c51832b436755 /native/src/proximity_info.cpp
parent8ca325f437a4dd6484e14ac66415b792195dbd40 (diff)
downloadlatinime-e05b3f4b3a57dcf99ade35bfbc1e1cdc3c3e476c.tar.gz
latinime-e05b3f4b3a57dcf99ade35bfbc1e1cdc3c3e476c.tar.xz
latinime-e05b3f4b3a57dcf99ade35bfbc1e1cdc3c3e476c.zip
Support additional proximity characters
Change-Id: Ifbe0d7e4eafea1926bbce968eae4724dd5769689
Diffstat (limited to 'native/src/proximity_info.cpp')
-rw-r--r--native/src/proximity_info.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/native/src/proximity_info.cpp b/native/src/proximity_info.cpp
index e0e938099..b6bab2274 100644
--- a/native/src/proximity_info.cpp
+++ b/native/src/proximity_info.cpp
@@ -261,7 +261,8 @@ ProximityInfo::ProximityType ProximityInfo::getMatchedProximityId(const int inde
// Not an exact nor an accent-alike match: search the list of close keys
int j = 1;
- while (j < MAX_PROXIMITY_CHARS_SIZE && currentChars[j] > 0) {
+ while (j < MAX_PROXIMITY_CHARS_SIZE
+ && currentChars[j] > ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE) {
const bool matched = (currentChars[j] == baseLowerC || currentChars[j] == c);
if (matched) {
if (proximityIndex) {
@@ -271,6 +272,21 @@ ProximityInfo::ProximityType ProximityInfo::getMatchedProximityId(const int inde
}
++j;
}
+ if (j < MAX_PROXIMITY_CHARS_SIZE
+ && currentChars[j] == ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE) {
+ ++j;
+ while (j < MAX_PROXIMITY_CHARS_SIZE
+ && currentChars[j] > ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE) {
+ const bool matched = (currentChars[j] == baseLowerC || currentChars[j] == c);
+ if (matched) {
+ if (proximityIndex) {
+ *proximityIndex = j;
+ }
+ return ADDITIONAL_PROXIMITY_CHAR;
+ }
+ ++j;
+ }
+ }
// Was not included, signal this as an unrelated character.
return UNRELATED_CHAR;