Description of problem: Currently, if the IME is deactivated while pre-edit buffer |= NULL, when the IME gets activated again, what was in the pre-edit buffer before will show up. Version-Release number of selected component (if applicable): scim-1.4.2-6 How reproducible: Always Steps to Reproduce: 1.in ja locale start gedit application (not locale specific) 2.activate scim 3.enter 'aka' 4.deactivate by ctrl-SPACE 5.activate scim again Actual results: Pre-edit buffer not empty Expected results: Pre-edit buffer should be emptied Additional info: Tried with CJK IME with similar behaviour.
I have talked with Su Zhe about this bug. He said this trigger hot key should be handled in IMEs. I think it means each IME should be update except it has handled this hot key. I wrote a test patch, just make IC reset when the IME is deactived. It seems work well. But Su Zhe think it's not a good way, because reset() has special usage. Below is my patch for reference : --- gtkimcontextscim.cpp.orig 2005-12-06 10:11:27.732624776 +0800 +++ gtkimcontextscim.cpp 2005-12-02 15:36:36.000000000 +0800 @@ -1256,8 +1256,10 @@ if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER) { if (!ic->impl->is_on) turn_on_ic (ic); - else + else { turn_off_ic (ic); + ic->impl->si->reset(); //qshen + } ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON) { if (!ic->impl->is_on)
I think it's better to handle this deactivate/activate hot key in frontend/gtkim moudle, because it's a global setting for frontend. We can set it in SCIM setup window | frontend | global setting. The common setting for this hot key is "Control+space". SCIM gtkim moudle names this hotkey as SCIM_CONFIG_HOTKEYS_FRONTEND_TRIGGER, and handles it in filter_hotkeys() . The X11 frontend has similar handling code for this hotkey. We konw that preedit string is managed by IC. Gtk-im transfer IC to SCIM, SCIM transfer IC to IME instance. IME can be accessed through IME APIs, but the only API to handle preedit string is reset() . So there are 2 choices to handle this bug. One is using reset() in frontend/gtkim module, Another is handling the hotkey in IME inside.
I had a talk with James Su. He said the hotkey should be handled in IMEs. He didn't accepted editing the front end module.
This behaviour should be implemented in each IMEngine. When scim is deactivated, the focus_out () method will be invoked, then IMEngine may do anything in this method, for example clearing the preedit string.
Thanks for the comment James. Are there any IMEs for which resetting pre-edit is not desirable?
AFAIK, some input methods provided by upcoming scim-m17n with m17n 1.3.x have such behaviour.
Patch has been reverted in Fedora devel since December.