From 54cbc26dbe474150fbee80805d5cd936bde67989 Mon Sep 17 00:00:00 2001 From: Li Zhang Date: Thu, 4 Aug 2016 19:04:19 +0800 Subject: [PATCH] Update preedit string with commit string Change-Id: I981404c169af658f3666b6d6523c5f21cfc1dfab --- src/ime-core/imi_view_classic.cpp | 5 ++++- wrapper/scim/src/sunpinyin_imengine.cpp | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ime-core/imi_view_classic.cpp b/src/ime-core/imi_view_classic.cpp index 37034bb..37384d9 100644 --- a/src/ime-core/imi_view_classic.cpp +++ b/src/ime-core/imi_view_classic.cpp @@ -90,7 +90,6 @@ CIMIClassicView::updateWindows(unsigned mask) m_uiPreeditString.clear(); getPreeditString(m_uiPreeditString); // m_pWinHandler->updatePreedit(&ps); - handlerUpdatePreedit(&m_uiPreeditString); } if ((mask & PREEDIT_MASK) || (mask & CANDIDATE_MASK)) { @@ -142,6 +141,10 @@ CIMIClassicView::updateWindows(unsigned mask) // m_pWinHandler->updateCandidates(&cl); handlerUpdateCandidates(&m_uiPreeditString, &m_uiCandidateList); } + + if (mask & PREEDIT_MASK) { + handlerUpdatePreedit(&m_uiPreeditString); + } } bool diff --git a/wrapper/scim/src/sunpinyin_imengine.cpp b/wrapper/scim/src/sunpinyin_imengine.cpp index 8b9e371..5c3a129 100644 --- a/wrapper/scim/src/sunpinyin_imengine.cpp +++ b/wrapper/scim/src/sunpinyin_imengine.cpp @@ -390,7 +390,7 @@ void SunPyInstance::reset () { SCIM_DEBUG_IMENGINE (3) << get_id() << ": reset()\n"; - flush(); + m_pv->clearIC(); m_lookup_table->clear (); hide_preedit_string (); //hide_aux_string (); @@ -606,9 +606,13 @@ SunPyInstance::redraw_preedit_string (const IPreeditString* ppd) ppd->charTypeSize(), SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_REVERSE)); } - update_preedit_string( wstr_to_widestr(ppd->string(), ppd->size()) ); + int hanzi_end = 0; + for ( ;hanzi_end < ppd->size(); hanzi_end++) + if (!(ppd->charTypeAt(hanzi_end) & IPreeditString::USER_CHOICE)) + break; + WideString preedit = wstr_to_widestr(ppd->string(), ppd->size()); + update_preedit_string( preedit, preedit.substr(0, hanzi_end) + m_lookup_table->get_candidate(0), attrs, caret); show_preedit_string (); - update_preedit_caret (caret); } else { hide_preedit_string (); } @@ -618,7 +622,7 @@ void SunPyInstance::redraw_lookup_table(const ICandidateList* pcl) { SCIM_DEBUG_IMENGINE (3) << get_id() << ": redraw_lookup_table()\n"; - + m_lookup_table->update(*pcl); if (m_lookup_table->number_of_candidates()) { update_lookup_table(*m_lookup_table); -- 2.7.4