fixes in_chewing_scheme
authorPeng Wu <alexepico@gmail.com>
Fri, 10 Feb 2012 06:25:59 +0000 (14:25 +0800)
committerPeng Wu <alexepico@gmail.com>
Fri, 10 Feb 2012 06:25:59 +0000 (14:25 +0800)
src/pinyin.cpp
src/storage/pinyin_parser2.cpp
src/storage/pinyin_parser2.h

index 4f32c68..e1ec93e 100644 (file)
@@ -425,7 +425,8 @@ size_t pinyin_parse_more_chewings(pinyin_instance_t * instance,
 bool pinyin_in_chewing_keyboard(pinyin_instance_t * instance,
                                 const char key, const char ** symbol) {
     pinyin_context_t * & context = instance->m_context;
-    return context->m_chewing_parser->in_chewing_scheme(key, symbol);
+    return context->m_chewing_parser->in_chewing_scheme
+        (context->m_options, key, symbol);
 }
 
 
index ab8330c..494daad 100644 (file)
@@ -777,7 +777,7 @@ int ChewingParser2::parse(pinyin_option_t options, ChewingKeyVector & keys,
     int maximum_len = 0; int i;
     /* probe the longest possible chewing string. */
     for (i = 0; i < len; ++i) {
-        if (!in_chewing_scheme(str[i], NULL))
+        if (!in_chewing_scheme(options, str[i], NULL))
             break;
     }
     maximum_len = i;
@@ -835,7 +835,8 @@ bool ChewingParser2::set_scheme(ChewingScheme scheme) {
 }
 
 
-bool ChewingParser2::in_chewing_scheme(const char key, const char ** symbol)
+bool ChewingParser2::in_chewing_scheme(pinyin_option_t options,
+                                       const char key, const char ** symbol)
  const {
     const gchar * chewing = NULL;
     char tone = CHEWING_ZERO_TONE;
@@ -846,6 +847,9 @@ bool ChewingParser2::in_chewing_scheme(const char key, const char ** symbol)
         return true;
     }
 
+    if (!(options & USE_TONE))
+        return false;
+
     if (search_chewing_tones(m_tone_table, key, &tone)) {
         if (symbol)
             *symbol = chewing_tone_table[tone];
index d651554..2ff46f3 100644 (file)
@@ -213,7 +213,7 @@ public:
 
 public:
     bool set_scheme(ChewingScheme scheme);
-    bool in_chewing_scheme(const char key, const char ** symbol) const;
+    bool in_chewing_scheme(pinyin_option_t options, const char key, const char ** symbol) const;
 };