fixes fillLookupTableByPage
authorPeng Wu <alexepico@gmail.com>
Wed, 4 Jul 2012 02:23:56 +0000 (10:23 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 4 Jul 2012 02:31:11 +0000 (10:31 +0800)
src/PYPPhoneticEditor.cc

index 73f5a09..a258a5d 100644 (file)
@@ -204,7 +204,7 @@ LibPinyinPhoneticEditor::fillLookupTableByPage (void)
     if (need_nr == 0)
         return FALSE;
 
-    String word;
+    String word, phrase_string;
     for (guint i = filled_nr; i < filled_nr + need_nr; i++) {
         if (i >= m_candidates->len)  /* no more candidates */
             break;
@@ -212,12 +212,21 @@ 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 = getPinyinCursor ();
+            phrase_string = g_utf8_offset_to_pointer
+                (candidate->m_phrase_string, cursor);
+        }
+
         /* show get candidates. */
         if (G_LIKELY (m_props.modeSimp ())) {
-            word = candidate->m_phrase_string;
+            word = phrase_string;
         } else { /* Traditional Chinese */
             word.truncate (0);
-            SimpTradConverter::simpToTrad (candidate->m_phrase_string, word);
+            SimpTradConverter::simpToTrad (phrase_string, word);
         }
 
         Text text (word);