Package: ibus-chewing Version: 1.3.9.2-2 Severity: normal This bug is reported in Ubuntu (LP: #690896), and I also found it can be reproduced in Debian unstable, so I attach the patch for fixing this bug.
I already verified my patch in Debian unstable and Ubuntu Natty, please help to review the patch, thanks. the root casue is that ibus-cheiwng has be set NEED_COMMIT status again when focus-in event is triiger, because the last key is Return key and libchewing is still Commit state. this bug only happens when you disable plain zhuin mode of ibus-chewing. Test Case --------- Step To Reproduce 1. set ibus-chewing don't use plain zhuin mode 2. launch gedit 3. create new unamed document and now you will have 2 unamed documents 4. type "測試" in first unamed document and then press Enter key to commit string 5. switch focus to second unamed document 6. switch focus back to first unamed document Excepted Result there is no chinese characters in first unamed documents Actual Result there is "測試測試測試測試" in first unamed docuemts -- System Information: Debian Release: sid Architecture: i386 (i686) -- no debconf information
Index: fix-690896/src/IBusChewingEngine-input-events.c =================================================================== --- fix-690896.orig/src/IBusChewingEngine-input-events.c 2011-07-12 20:14:27.172895000 +0800 +++ fix-690896/src/IBusChewingEngine-input-events.c 2011-07-12 20:14:41.838212985 +0800 @@ -220,6 +220,7 @@ G_DEBUG_MSG(2,"[I2] handle_Default(-,%u) plainZhuyin=%s inputMode=%d", keyval,(self->chewingFlags & CHEWING_FLAG_PLAIN_ZHUYIN)? "TRUE": "FALSE",self->inputMode); ibus_chewing_engine_set_status_flag(self, ENGINE_STATUS_NEED_COMMIT); + self->hasCommit=1; #ifdef EASY_SYMBOL_INPUT_WORK_AROUND if (self->chewingFlags & CHEWING_FLAG_EASY_SYMBOL_INPUT){ /* If shift is pressed, turn on the easySymbolInput, turn off Index: fix-690896/src/IBusChewingEngine.gob =================================================================== --- fix-690896.orig/src/IBusChewingEngine.gob 2011-07-12 20:14:27.172895000 +0800 +++ fix-690896/src/IBusChewingEngine.gob 2011-07-12 20:14:52.102263875 +0800 @@ -190,6 +190,9 @@ /* Controlling flags */ protected ChewingFlag chewingFlags=0; + /* For checking the string is commited */ + public guint hasCommit=0; + private guint statusFlags=0; /* For easy symbol input work around */ @@ -732,7 +735,8 @@ G_DEBUG_MSG(5, "[I5] determine_input_mode(): TotalChoice=%d", totalChoice); if (chewing_commit_Check(self->context) && (self->_priv->key_last==IBUS_Return || self->_priv->key_last==IBUS_KP_Enter)){ - ibus_chewing_engine_set_status_flag(self,ENGINE_STATUS_NEED_COMMIT); + if(!self->hasCommit) + ibus_chewing_engine_set_status_flag(self,ENGINE_STATUS_NEED_COMMIT); } if (totalChoice >0){ /* Candidate selection mode ensure. */ @@ -819,6 +823,12 @@ G_DEBUG_MSG(2,"[I2] commit() commit:%s", commit_string); IBusText *iText=g_object_ref_sink(ibus_text_new_from_string(commit_string)); ibus_engine_commit_text(IBUS_ENGINE(self),iText); + /*Fix libchewing bug: 308, launchpad bug: 690896 + Indicate the string is commited to avoid update() set NEED_COMMIT status + again when focus in event is triiger, because the last key is Return key + and libchewing is still Commit state. + */ + self->hasCommit = 1; g_object_unref(iText); chewing_free(commit_string); return TRUE; @@ -1052,4 +1062,3 @@ %{ #include "IBusChewingEngine-input-events.c" %} -