From e16682240d6df8777a7b6605811258b5ec71cec1 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 4 Jul 2012 13:19:47 +0800 Subject: [PATCH 1/2] fixes fillLookupTableByPage --- src/PYPPhoneticEditor.cc | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc index bdc05d8..a9b81ce 100644 --- a/src/PYPPhoneticEditor.cc +++ b/src/PYPPhoneticEditor.cc @@ -204,7 +204,7 @@ LibPinyinPhoneticEditor::fillLookupTableByPage (void) if (need_nr == 0) return FALSE; - String word, phrase_string; + String word; for (guint i = filled_nr; i < filled_nr + need_nr; i++) { if (i >= m_candidates->len) /* no more candidates */ break; @@ -212,14 +212,7 @@ LibPinyinPhoneticEditor::fillLookupTableByPage (void) lookup_candidate_t * candidate = &g_array_index (m_candidates, lookup_candidate_t, i); - phrase_string = candidate->m_phrase_string; - - if (BEST_MATCH_CANDIDATE == candidate->m_candidate_type) { - /* hide selected part */ - guint cursor = getLookupCursor (); - phrase_string = g_utf8_offset_to_pointer - (candidate->m_phrase_string, cursor); - } + const gchar * phrase_string = candidate->m_phrase_string; /* show get candidates. */ if (G_LIKELY (m_props.modeSimp ())) { -- 1.7.10.4 From a742f0e61a9cc81ee14f5d66070bede4a737fa18 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 4 Jul 2012 15:19:05 +0800 Subject: [PATCH 2/2] uses pinyin_load_phrase_library --- src/PYLibPinyin.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PYLibPinyin.cc b/src/PYLibPinyin.cc index dd56fa7..621863b 100644 --- a/src/PYLibPinyin.cc +++ b/src/PYLibPinyin.cc @@ -64,6 +64,7 @@ LibPinyinBackEnd::allocPinyinInstance () g_free(userdir); userdir = NULL; } m_pinyin_context = pinyin_init ("/usr/share/libpinyin/data", userdir); + pinyin_load_phrase_library(m_pinyin_context, 2); g_free(userdir); } @@ -87,7 +88,8 @@ LibPinyinBackEnd::allocChewingInstance () if (retval) { g_free(userdir); userdir = NULL; } - m_chewing_context = pinyin_init ("/usr/share/libpinyin/data", NULL); + m_chewing_context = pinyin_init ("/usr/share/libpinyin/data", userdir); + pinyin_load_phrase_library(m_chewing_context, 2); g_free(userdir); } -- 1.7.10.4