diff options
author | Peng Wu <alexepico@gmail.com> | 2011-10-08 11:40:11 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-12-22 12:23:14 +0800 |
commit | 6a11e90a42cbca5c4a0990b5af780a61e4770d1e (patch) | |
tree | 4d2fbda44766829294ce64a37437de70f86c34cc /src/PYPBopomofoEditor.cc | |
parent | c22d0d6a24c969821e60f624fd93b1851fc334ab (diff) | |
download | ibus-libpinyin-6a11e90a42cbca5c4a0990b5af780a61e4770d1e.tar.gz ibus-libpinyin-6a11e90a42cbca5c4a0990b5af780a61e4770d1e.tar.xz ibus-libpinyin-6a11e90a42cbca5c4a0990b5af780a61e4770d1e.zip |
fixes chewing editor
Diffstat (limited to 'src/PYPBopomofoEditor.cc')
-rw-r--r-- | src/PYPBopomofoEditor.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc index f13fcc9..1a330cc 100644 --- a/src/PYPBopomofoEditor.cc +++ b/src/PYPBopomofoEditor.cc @@ -351,7 +351,8 @@ LibPinyinBopomofoEditor::updateAuxiliaryText (void) if (G_UNLIKELY (cursor == m_cursor)) { /* at word boundary. */ m_buffer << '|' << key->get_key_zhuyin_string (); - } else { /* in word */ + } else if (G_LIKELY ( cursor < m_cursor && + m_cursor < pos->get_end_pos() )) { /* in word */ /* raw text */ String raw = m_text.substr (cursor, pos->get_length ()); guint offset = m_cursor - cursor; @@ -366,9 +367,14 @@ LibPinyinBopomofoEditor::updateAuxiliaryText (void) for ( iter = after.begin (); iter != after.end (); ++iter) { m_buffer << bopomofo_char[keyvalToBopomofo (*iter)]; } + } else { /* other words */ + m_buffer << ' ' << key->get_key_zhuyin_string (); } } + if (m_cursor == m_pinyin_len) + m_buffer << '|'; + /* append rest text */ const gchar * p = m_text.c_str() + m_pinyin_len; m_buffer << p; |