diff options
Diffstat (limited to 'src/PYPBopomofoEditor.cc')
-rw-r--r-- | src/PYPBopomofoEditor.cc | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc index 599d195..688fb5f 100644 --- a/src/PYPBopomofoEditor.cc +++ b/src/PYPBopomofoEditor.cc @@ -302,7 +302,7 @@ BopomofoEditor::updatePinyin (void) } void -BopomofoEditor::commit (gint index) +BopomofoEditor::commit (const gchar *str) { if (G_UNLIKELY (m_text.empty ())) return; @@ -310,16 +310,7 @@ BopomofoEditor::commit (gint index) m_buffer.clear (); /* sentence candidate */ - char *tmp = NULL; - pinyin_get_sentence (m_instance, index, &tmp); - if (tmp) { - if (m_props.modeSimp ()) { - m_buffer << tmp; - } else { - SimpTradConverter::simpToTrad (tmp, m_buffer); - } - g_free (tmp); - } + m_buffer << str; /* text after pinyin */ const gchar *p = m_text.c_str() + m_pinyin_len; @@ -339,11 +330,13 @@ BopomofoEditor::commit (gint index) ++p; } - pinyin_train(m_instance, index); if (m_config.rememberEveryInput ()) - LibPinyinBackEnd::instance ().rememberUserInput (m_instance, index); + LibPinyinBackEnd::instance ().rememberUserInput (m_instance, str); LibPinyinBackEnd::instance ().modified(); - PhoneticEditor::commit ((const gchar *)m_buffer); + + Text text (m_buffer.c_str ()); + commitText (text); + reset(); } |