diff --git a/scim-wnn/src/scim_wnn_imengine.cpp b/scim-wnn/src/scim_wnn_imengine.cpp index bb6c503..8fe982a 100644 --- a/scim-wnn/src/scim_wnn_imengine.cpp +++ b/scim-wnn/src/scim_wnn_imengine.cpp @@ -472,24 +472,36 @@ void WnnInstance::reset () { - + alp_count = 0; + m_conversion = false; + m_lookup = false; + hide_lookup_table (); + hide_preedit_string (); + wnn.reset(); + m_rk.reset(); } void WnnInstance::focus_in () { - hide_aux_string (); - - if (m_lookup_table.number_of_candidates ()) { - update_lookup_table (m_lookup_table); - show_lookup_table (); - } else { - hide_lookup_table (); - } - } void WnnInstance::focus_out () { + if (m_conversion) { + commit_string(wnn.getText()); + wnn.updateFrequency(); + m_rk.reset(); + wnn.reset(); + m_conversion = false; + hide_preedit_string(); + hide_lookup_table(); + m_lookup = false; + alp_count = 0; + } else if (m_rk.getTextLength()) { + commit_string(m_rk.getText(true)); + m_rk.reset(); + hide_preedit_string(); + } } void WnnInstance::trigger_property (const String &property)