static void ibus_hangul_engine_flush (IBusHangulEngine *hangul) { const gunichar *str; IBusText *text; ibus_hangul_engine_hide_lookup_table (hangul); str = hangul_ic_flush (hangul->context); ustring_append_ucs4 (hangul->preedit, str, -1); if (ustring_length (hangul->preedit) != 0) { /* clear preedit text before commit */ ibus_hangul_engine_clear_preedit_text (hangul); str = ustring_begin (hangul->preedit); text = ibus_text_new_from_ucs4 (str); ibus_engine_commit_text ((IBusEngine *) hangul, text); ustring_clear(hangul->preedit); } ibus_hangul_engine_update_preedit_text (hangul); }
void nimf_libhangul_reset (NimfEngine *engine, NimfServiceIC *target) { g_debug (G_STRLOC ": %s", G_STRFUNC); g_return_if_fail (NIMF_IS_ENGINE (engine)); NimfLibhangul *hangul = NIMF_LIBHANGUL (engine); /* workaround: ignore reset called by commit callback in application */ if (G_UNLIKELY (hangul->ignore_reset_in_commit_cb && hangul->is_committing)) return; nimf_candidatable_hide (hangul->candidatable); const ucschar *flush; flush = hangul_ic_flush (hangul->context); if (flush[0] != 0) { gchar *text = g_ucs4_to_utf8 (flush, -1, NULL, NULL, NULL); nimf_libhangul_emit_commit (engine, target, text); g_free (text); } nimf_libhangul_update_preedit (engine, target, g_strdup ("")); }
void QHangulPlatformInputContext::reset() { if (m_candidateList != NULL && m_candidateList->isVisible()) { m_candidateList->close(); } const ucschar *flushed = hangul_ic_flush(m_hic); // we do not send preedit update IMEvent // because commit() send InputMethodEnd event and it remove preedit string QString commitString = ucsToQString(flushed); if (!commitString.isEmpty()) { commitText(commitString); } else { updatePreedit(""); } }
void HangulInstance::flush() { SCIM_DEBUG_IMENGINE(2) << "flush.\n"; hide_preedit_string(); WideString wstr = m_preedit; const ucschar *str = hangul_ic_flush(m_hic); while (*str != 0) wstr.push_back (*str++); if (wstr.length()) commit_string(wstr); delete_candidates (); m_preedit.clear(); }
static PyObject *_pyhangulic_flush(PY_HANGULIC *self, PyObject *args) { #ifndef Py_UNICODE_WIDE int i; Py_UNICODE *buf; #endif /* !Py_UNICODE_WIDE */ int len; const ucschar *str; str = hangul_ic_flush(self->hic); len = ucscharlen(str); #ifdef Py_UNICODE_WIDE return PyUnicode_FromUnicode((Py_UNICODE*)str, len); #else /* Py_UNICODE_WIDE */ buf = alloca(sizeof(Py_UNICODE) * len); for (i = 0; i < len; i++) buf[i] = str[i]; return PyUnicode_FromUnicode(buf, len); #endif /* Py_UNICODE_WIDE */ }