summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-03-22 14:09:53 +0800
committerPeng Wu <alexepico@gmail.com>2013-03-22 14:09:53 +0800
commit2f153759c57835aa30908ae0d43dda1f942bdfac (patch)
tree70dd92451e4a0c1d1bbda1312101e2d6e2520193 /src
parent88176ebec678099baa5b768e862ea2b41fdfc5ba (diff)
downloadibus-libpinyin-2f153759c57835aa30908ae0d43dda1f942bdfac.tar.gz
ibus-libpinyin-2f153759c57835aa30908ae0d43dda1f942bdfac.tar.bz2
ibus-libpinyin-2f153759c57835aa30908ae0d43dda1f942bdfac.zip
update pinyin editor
Diffstat (limited to 'src')
-rw-r--r--src/PYPPinyinEditor.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/PYPPinyinEditor.cc b/src/PYPPinyinEditor.cc
index 5380c02..d8a407b 100644
--- a/src/PYPPinyinEditor.cc
+++ b/src/PYPPinyinEditor.cc
@@ -211,7 +211,7 @@ LibPinyinPinyinEditor::commit ()
/* sentence candidate */
char *tmp = NULL;
- pinyin_get_sentence(m_instance, &tmp);
+ pinyin_get_sentence (m_instance, &tmp);
if (tmp) {
if (m_props.modeSimp ()) {
m_buffer << tmp;
@@ -231,7 +231,7 @@ LibPinyinPinyinEditor::commit ()
m_buffer << p;
}
- pinyin_train(m_instance);
+ pinyin_train (m_instance);
LibPinyinBackEnd::instance ().modified ();
LibPinyinPhoneticEditor::commit ((const gchar *)m_buffer);
reset();
@@ -248,7 +248,7 @@ LibPinyinPinyinEditor::updatePreeditText ()
m_buffer.clear ();
char *tmp = NULL;
- pinyin_get_sentence(m_instance, &tmp);
+ pinyin_get_sentence (m_instance, &tmp);
if (tmp) {
if (m_props.modeSimp ()) {
m_buffer<<tmp;
@@ -282,17 +282,22 @@ LibPinyinPinyinEditor::updateAuxiliaryText ()
m_buffer.clear ();
/* Note: cursor handling is defered to full/double pinyin editors. */
- // guint pinyin_cursor = getPinyinCursor ();
- PinyinKeyVector & pinyin_keys = m_instance->m_pinyin_keys;
- for (guint i = 0; i < pinyin_keys->len; ++i) {
+
+ guint len = 0;
+ pinyin_get_n_pinyin (m_instance, &len);
+
+ for (guint i = 0; i < len; ++i) {
if (G_LIKELY (i))
m_buffer << ' ';
- PinyinKey *key = &g_array_index (pinyin_keys, PinyinKey, i);
+ PinyinKey *key = NULL;
+ pinyin_get_pinyin_key (m_instance, i, &key);
+
gchar * str = NULL;
- pinyin_get_pinyin_string(m_instance, key, &str);
+ pinyin_get_pinyin_string (m_instance, key, &str);
+
m_buffer << str;
- g_free(str);
+ g_free (str);
}
/* append rest text */