improves full pinyin parse_one_key
authorPeng Wu <alexepico@gmail.com>
Tue, 22 Nov 2011 09:05:17 +0000 (17:05 +0800)
committerPeng Wu <alexepico@gmail.com>
Tue, 22 Nov 2011 09:05:17 +0000 (17:05 +0800)
src/storage/pinyin_parser2.cpp

index 9c5876c..3f3b5d9 100644 (file)
@@ -177,11 +177,9 @@ bool FullPinyinParser2::parse_one_key (guint32 options, ChewingKey & key,
     /* parse pinyin core staff here. */
 
     /* Note: optimize here? */
-    for (; parsed_len >= len - 1; --parsed_len) {
-        input[parsed_len] = '\0';
-        if (search_pinyin_index(options, input, key, key_rest))
-            break;
-    }
+    input[parsed_len] = '\0';
+    if (!search_pinyin_index(options, input, key, key_rest))
+        --parsed_len;
 
     if (options & USE_TONE) {
         /* post processing tone. */