summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/storage/pinyin_parser2.cpp6
-rw-r--r--src/storage/pinyin_parser2.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index f78653f..bdbe385 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -132,6 +132,9 @@ gchar * _ChewingKey::get_bopomofo_string() {
if (CHEWING_ZERO_TONE == m_tone) {
return g_strdup(item.m_bopomofo);
+ } else if (CHEWING_1 == m_tone) {
+ /* for first tone, usually not display it. */
+ return g_strdup(item.m_bopomofo);
} else {
return g_strdup_printf("%s%s", item.m_bopomofo,
chewing_tone_table[m_tone]);
@@ -1263,7 +1266,8 @@ bool ChewingDirectParser2::parse_one_key(pinyin_option_t options,
ChewingKey & key,
const char *str, int len) const {
options &= ~ZHUYIN_AMB_ALL;
- unsigned char tone = CHEWING_ZERO_TONE;
+ /* by default, chewing will use the first tone. */
+ unsigned char tone = CHEWING_1;
if (0 == len)
return false;
diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h
index 72635c0..9b9d78e 100644
--- a/src/storage/pinyin_parser2.h
+++ b/src/storage/pinyin_parser2.h
@@ -388,8 +388,12 @@ inline int pinyin_compare_middle_and_final2(pinyin_option_t options,
inline int pinyin_compare_tone2(pinyin_option_t options,
ChewingTone lhs,
ChewingTone rhs) {
+#if 0
if (lhs == rhs)
return 0;
+#endif
+ if (options & FORCE_TONE)
+ return (lhs - rhs);
if (lhs == CHEWING_ZERO_TONE)
return 0;
if (rhs == CHEWING_ZERO_TONE)