Exemple #1
0
void QinPinyin::update_preedit_string(const IPreeditString& preedit)
{
  const int len = preedit.size();
  if (len > 0) {
    preeditStr = TWCHAR2str(preedit.string(), preedit.size());
  } else {
    preeditStr.clear();
  }
}
void
SunPinyinEngine::update_preedit_string(const IPreeditString& preedit)
{
    const int len = preedit.size();
    if (len > 0) {
        IBusText *text = ibus_text_new_from_ucs4((const gunichar*) preedit.string());
        
        
        const int caret = preedit.caret();
        if (caret < len) {
            decorate_preedit_string_using_caret_pos(text, preedit, caret);
        } else {
            decorate_preedit_string_using_char_type(text, preedit);
        }
        
        ibus_engine_update_preedit_text(m_engine, text, caret, TRUE);
    } else {
        ibus_engine_hide_preedit_text(m_engine);
    }
}