show the rest of guessed sentence
authorPeng Wu <alexepico@gmail.com>
Mon, 7 Nov 2011 07:09:46 +0000 (15:09 +0800)
committerPeng Wu <alexepico@gmail.com>
Thu, 22 Dec 2011 04:23:15 +0000 (12:23 +0800)
src/PYPPhoneticEditor.cc

index b9dbc85..4f2c1e1 100644 (file)
@@ -195,7 +195,7 @@ LibPinyinPhoneticEditor::fillLookupTableByPage (void)
             (m_candidates, phrase_token_t, i);
 
         if (null_token == *token) {
-            /* show guessed sentence. */
+            /* show the rest of guessed sentence after the cursor. */
             String buffer;
             char *tmp = NULL;
             pinyin_get_sentence(m_instance, &tmp);
@@ -206,8 +206,10 @@ LibPinyinPhoneticEditor::fillLookupTableByPage (void)
                     SimpTradConverter::simpToTrad (tmp, buffer);
                 }
             }
-            Text text(buffer);
-            m_lookup_table.appendCandidate(text);
+
+            guint lookup_cursor = getLookupCursor ();
+            gchar * rest = g_utf8_offset_to_pointer (buffer.c_str (), lookup_cursor);
+            m_lookup_table.appendCandidate (Text (rest));
             g_free (tmp);
             continue;
         }