From: Seiichi S. <ss...@sh...> - 2004-11-03 05:31:56
|
On Tue, Nov 02, 2004 at 02:29:50PM +0900, Kenichi Handa wrote: > In article <20041102040301.GA3385%ss...@sh...>, Seiichi SATO <ss= at...@sh...> writes: >=20 > > Sorry for my late reply. > > On Fri, Oct 29, 2004 at 08:50:03AM +0900, > > Kenichi Handa wrote: >=20 > >> When I type 'a' while activating m17nlib:ja:anthy, =8E=BC=8E=A6=8E=BC= =8E=A4 is > >> shown with underline. But, when I type Shift-SPC to turn > >> the input method off, =8E=BC=8E=A6=8E=BC=8E=A4 is still shown with = underline and > >> not sent to terminal. I think that preedit text should be > >> fixed and sent to terminal before turning off the input > >> method. >=20 > > I think that there are three ways for turning off IM in preediting. >=20 > > A) ignore request for switching mode (uim) > > B) clear current preedit text (MS-IME, IIIMF, kinput2, skkinput) > > C) commit current preedit text (nabi, Handa-san's opinion) >=20 > > (I don't know which way is the most useful...) >=20 > > A is easy to implement for me, but B and C are hard. In cases of > > B and C, preedit must be cleared, but it seems that m17n-lib does > > not provide API for it (except for re-creating MInputContext). > > If I understand correctly, I'll adopt A. >=20 > If you want to perform B or C without destroying > MInputContext, for B, you can use minput_toggle, and for C, > you can directly access the M-text in MInputContext->preedit > to retrieve the current preedit text. It's also possible to > get only a subrange of preedit text before > `in-preedit-cursor' by checking MInputContext->cursor_pos. I tested minput_toggle() with the following code: minput_toggle(ic); if (!ic->active) { printf("length of preedit text: %d\n", mtext_len(ic->preedit)); } The result of this code is "length of preedit text: 1" after msymbol("a") was through minput_filter(). If preedit text was cleared by minput_toggle(), I think the length should be 0. I modified above code as below and got an expected result. minput_filter(ic, Mnil, Mnil); /* <-- added */ minput_toggle(ic); if (!ic->active) { printf("length of preedit text: %d\n", mtext_len(ic->preedit)); } Am I using minput_filter() and minput_toggle() correctly? --=20 Seiichi |