engine->engine = new LibPinyinPinyinEngine (IBUS_ENGINE (engine));
}
if (std::strcmp (name, "libbopomofo") == 0 ||
- std::strcmp (name, "libbopomofo") == 0 ) {
+ std::strcmp (name, "libbopomofo-debug") == 0 ) {
engine->engine = new LibPinyinBopomofoEngine (IBUS_ENGINE (engine));
}
} else {
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;
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;