diff options
author | Peng Wu <alexepico@gmail.com> | 2011-11-08 13:14:34 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-12-22 12:23:15 +0800 |
commit | 4052c696561ff06e74029cd1ec43355295e15e8c (patch) | |
tree | bb4d129d775b42c191e77d72c6d359e28ddddcfb | |
parent | 705c791f5c535bc02c349c6ea686d6b69db6b559 (diff) | |
download | ibus-libpinyin-4052c696561ff06e74029cd1ec43355295e15e8c.tar.gz |
remove duplicated candidates
-rw-r--r-- | src/PYPPhoneticEditor.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc index e79e492..b5903ae 100644 --- a/src/PYPPhoneticEditor.cc +++ b/src/PYPPhoneticEditor.cc @@ -190,11 +190,11 @@ LibPinyinPhoneticEditor::fillLookupTableByPage (void) if (need_nr == 0) return FALSE; + String first_candidate, candidate; for (guint i = filled_nr; i < filled_nr + need_nr; i++) { phrase_token_t *token = &g_array_index (m_candidates, phrase_token_t, i); - String first_candidate, candidate; if (null_token == *token) { /* show the rest of guessed sentence after the cursor. */ String buffer; @@ -216,6 +216,13 @@ LibPinyinPhoneticEditor::fillLookupTableByPage (void) pinyin_translate_token(m_instance, *token, &word); candidate = word; + /* remove duplicated candidates */ + if (candidate == first_candidate) { + g_array_remove_index (m_candidates, i); + --i; + continue; + } + /* show get candidates. */ if (G_UNLIKELY (!m_props.modeSimp ())) { /* Traditional Chinese */ candidate.truncate (0); |