fixes choose candidate
authorPeng Wu <alexepico@gmail.com>
Tue, 11 Oct 2011 03:14:18 +0000 (11:14 +0800)
committerPeng Wu <alexepico@gmail.com>
Thu, 22 Dec 2011 04:23:14 +0000 (12:23 +0800)
src/PYPPhoneticEditor.cc

index dc494d5..6be7079 100644 (file)
@@ -318,8 +318,14 @@ LibPinyinPhoneticEditor::selectCandidate (guint i)
 
     /* NOTE: deal with normal candidates selection here by libpinyin. */
     phrase_token_t *token = &g_array_index (m_candidates, phrase_token_t, i);
-    pinyin_choose_candidate (m_instance, pinyin_cursor, *token);
+    guint8 len = pinyin_choose_candidate (m_instance, pinyin_cursor, *token);
     pinyin_guess_sentence (m_instance);
+
+    pinyin_cursor += len;
+    PinyinKeyPos *pos = &g_array_index
+        (m_instance->m_pinyin_poses, PinyinKeyPos, pinyin_cursor);
+    m_cursor = pos->get_pos();
+
     return TRUE;
 }