summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-08-12 13:02:50 +0800
committerPeng Wu <alexepico@gmail.com>2016-08-12 13:02:50 +0800
commit3647a6691f643b6a820518e5021e03baed332da4 (patch)
tree11dbe13fad7d1b6a2b3f62c14c2e9f1b445cbc0c
parent9dbb8e7a8ac2fc5b3ee9b99c235f525233e242e7 (diff)
downloadlibpinyin-3647a6691f643b6a820518e5021e03baed332da4.tar.gz
libpinyin-3647a6691f643b6a820518e5021e03baed332da4.tar.xz
libpinyin-3647a6691f643b6a820518e5021e03baed332da4.zip
fixes pinyin_get_character_offset function
-rw-r--r--src/pinyin.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 6d8738c..29c4c8c 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -2488,9 +2488,6 @@ static bool _get_char_offset_recur(pinyin_instance_t * instance,
const size_t newstart = key_rest.m_raw_end;
- if (newstart > offset)
- return true;
-
const ChewingKey zero_key;
if (zero_key == key) {
/* assume only one key here for "'" or the last key. */
@@ -2508,6 +2505,9 @@ static bool _get_char_offset_recur(pinyin_instance_t * instance,
if (pinyin_poss < FLT_EPSILON)
continue;
+ if (newstart > offset)
+ return true;
+
++length;
result = _get_char_offset_recur