summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-12-05 12:03:21 +0800
committerPeng Wu <alexepico@gmail.com>2012-12-05 12:03:21 +0800
commit241bac9ba834573c25db72c44bff9d118a4ffe9f (patch)
tree23e34a91659fc6b8a7520aa8c9adaa9d60994826 /src
parent938f2649b75efb3f0b72f3af7567ad8198d17147 (diff)
downloadibus-libpinyin-241bac9ba834573c25db72c44bff9d118a4ffe9f.tar.gz
ibus-libpinyin-241bac9ba834573c25db72c44bff9d118a4ffe9f.tar.xz
ibus-libpinyin-241bac9ba834573c25db72c44bff9d118a4ffe9f.zip
fixes get_pinyin_string
Diffstat (limited to 'src')
-rw-r--r--src/PYPDoublePinyinEditor.cc9
-rw-r--r--src/PYPFullPinyinEditor.cc9
-rw-r--r--src/PYPPinyinEditor.cc6
3 files changed, 19 insertions, 5 deletions
diff --git a/src/PYPDoublePinyinEditor.cc b/src/PYPDoublePinyinEditor.cc
index 70b2847..b023313 100644
--- a/src/PYPDoublePinyinEditor.cc
+++ b/src/PYPDoublePinyinEditor.cc
@@ -135,8 +135,11 @@ LibPinyinDoublePinyinEditor::updateAuxiliaryText (void)
PinyinKeyPos *pos = &g_array_index (pinyin_poses, PinyinKeyPos, i);
guint cursor = pos->m_raw_begin;
+ gchar * str = NULL;
if (G_UNLIKELY (cursor == m_cursor)) { /* at word boundary. */
- m_buffer << '|' << key->get_pinyin_string ();
+ pinyin_get_pinyin_string(m_instance, key, &str);
+ m_buffer << '|' << str;
+ g_free(str);
} else if (G_LIKELY ( cursor < m_cursor &&
m_cursor < pos->m_raw_end )) { /* in word */
/* raw text */
@@ -146,7 +149,9 @@ LibPinyinDoublePinyinEditor::updateAuxiliaryText (void)
m_buffer << ' ' << raw.substr (0, offset)
<< '|' << raw.substr (offset);
} else { /* other words */
- m_buffer << ' ' << key->get_pinyin_string ();
+ pinyin_get_pinyin_string(m_instance, key, &str);
+ m_buffer << ' ' << str;
+ g_free(str);
}
}
diff --git a/src/PYPFullPinyinEditor.cc b/src/PYPFullPinyinEditor.cc
index eb58b6b..0641203 100644
--- a/src/PYPFullPinyinEditor.cc
+++ b/src/PYPFullPinyinEditor.cc
@@ -101,8 +101,11 @@ LibPinyinFullPinyinEditor::updateAuxiliaryText ()
PinyinKeyPos *pos = &g_array_index (pinyin_poses, PinyinKeyPos, i);
guint cursor = pos->m_raw_begin;
+ gchar * str = NULL;
if (G_UNLIKELY (cursor == m_cursor)) { /* at word boundary. */
- m_buffer << '|' << key->get_pinyin_string ();
+ pinyin_get_pinyin_string(m_instance, key, &str);
+ m_buffer << '|' << str;
+ g_free(str);
} else if (G_LIKELY ( cursor < m_cursor &&
m_cursor < pos->m_raw_end )) { /* in word */
/* raw text */
@@ -112,7 +115,9 @@ LibPinyinFullPinyinEditor::updateAuxiliaryText ()
m_buffer << ' ' << raw.substr (0, offset)
<< '|' << raw.substr (offset);
} else { /* other words */
- m_buffer << ' ' << key->get_pinyin_string ();
+ pinyin_get_pinyin_string(m_instance, key, &str);
+ m_buffer << ' ' << str;
+ g_free(str);
}
}
diff --git a/src/PYPPinyinEditor.cc b/src/PYPPinyinEditor.cc
index 220ab5c..5380c02 100644
--- a/src/PYPPinyinEditor.cc
+++ b/src/PYPPinyinEditor.cc
@@ -287,8 +287,12 @@ LibPinyinPinyinEditor::updateAuxiliaryText ()
for (guint i = 0; i < pinyin_keys->len; ++i) {
if (G_LIKELY (i))
m_buffer << ' ';
+
PinyinKey *key = &g_array_index (pinyin_keys, PinyinKey, i);
- m_buffer << key->get_pinyin_string ();
+ gchar * str = NULL;
+ pinyin_get_pinyin_string(m_instance, key, &str);
+ m_buffer << str;
+ g_free(str);
}
/* append rest text */