Update preedit string with commit string 02/82602/3
authorLi Zhang <li2012.zhang@samsung.com>
Thu, 4 Aug 2016 11:04:19 +0000 (19:04 +0800)
committerLi Zhang <li2012.zhang@samsung.com>
Thu, 4 Aug 2016 13:37:23 +0000 (21:37 +0800)
Change-Id: I981404c169af658f3666b6d6523c5f21cfc1dfab

src/ime-core/imi_view_classic.cpp
wrapper/scim/src/sunpinyin_imengine.cpp

index 37034bb..37384d9 100644 (file)
@@ -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
index 8b9e371..5c3a129 100644 (file)
@@ -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);