Kazuki, I am having multiple problems with this patch that needs addressing before I can merge it:
2009/8/20 Kazuki Sakamoto: > > I made a patch of TIS handling for cooperation with iminsert/imsearch. > > > Explanation of this patch: > > > NOTE: Check IM state _before_ key has been interpreted or we'll pick up > > the old IM state when it has been switched via a keyboard shortcut that > > MacVim cannot handle. > > A keyboard shortcut for switching IM state (link Command-Space) does > not reach MacVim. So MacVim checks IM state when keyDown: called. I > modified the timing of checking IM state in keyDown: method. Ok, that sounds reasonable. > Case of checking IM state before/after ESC key: > before: IM switch(off>on) > check IM state(on) > handle key > save > iminsert(on) > after : IM switch(off>on) > handle key > save iminsert(off) > check IM > state(on) > > I expected _before_ behavior. Sorry, I don't understand the "before" and "after"? > BTW, I tried to use CFNotificationCenterAddObserver with > kTISNotifySelectedKeyboardInputSourceChanged for handling when IM is > enabled/disabled, but I couldn't. > > http://developer.apple.com/documentation/TextFonts/Reference/TextInputSourcesReference/Reference/reference.html#//apple_ref/doc/uid/TP40006199-CH4-SW1 I have implemented this in the past, but the way I implemented IM it is not required. Why would you need this? Why do you need to know when the IM has switched? > > HACK! interpretKeyEvents: does not call doCommandBySelector: > > with Ctrl-6 or Ctrl-^ when IM is active. > > Ctrl-^ switches IM state in Vim, it works properly on MacVim when IM > is not active. So I hacked handling Ctrl-6 and Ctrl-^ when IM is > active. I don't like this, but I can't think of any way to handle it better. Note that your solution will break if 'macmeta' is enabled. > > Save current locale input source for use when IM is active and > > get an ASCII source for use when IM is deactivated (by Vim). > > Ctrl-^ could not switch IM state without it. This I do not get and it also breaks IM the way I wanted it to work. With your patch, as soon as I enter insert mode it switches to Swedish layout (I'm in Sweden). If I have several different layouts, e.g. US, Swedish and Kotoeri, and go to insert mode and switch to Kotoeri, then when I press Esc and go back to insert mode it will go back to Swedish again even though it should swtich to Kotoeri (the last layout used in insert mode). In other words: I can no longer choose which layout that should be used in insert mode. Without your patch, I enter insert mode, choose my layout and then it is remembered. If I change the layout in insert mode, the new layout will be used. This is how I want it to work (just because I am in Sweden that does not imply that Swedish will be the only non-English layout that I'll use). You have moved code from from activateIm to checkImState, but this makes absolutely no sense to me. Please explain. Why do you need to send the ActivateImMsgID to Vim when the input method changes? I know this is how the old code works but I specifically changed the new IM code so that it did not have to. To summarize: the hack to fix Ctrl-6 I will (reluctantly) accept if you fix it so that it works with 'macmeta'. The rest breaks IM so that is no longer usable. Björn --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_mac" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
