rogual / neovim-dot-app

Mac OS X GUI for Neovim
1.13k stars 62 forks source link

IME support #70

Open rogual opened 9 years ago

rogual commented 9 years ago

Originally requested in https://github.com/rogual/neovim-dot-app/issues/63.

rogual commented 9 years ago

It seems, to support IMEs:

  1. VimView will need to implement NSTextInputClient
  2. We'll need to send key events to Cocoa (possibly with handleEvent) only in insert mode.
    1. But, we don't want to clobber insert-mode bindings. For example, <C-o> should still go to Vim.
    2. handleEvent tells us whether “the system consumed the event”, so maybe we can use this to decide what to send to Vim.
  3. Vim only tells us we've entered insert mode in its redraw notification, so if the user presses i, we won't know to start sending keys to Cocoa until the next redraw, by which time they may have pressed more keys. So, our options are:
    1. Tell people to type more slowly
    2. Wait for a refresh after every keypress
    3. Ask Vim what mode we're in after every keypress
rogual commented 9 years ago

Started branch https://github.com/rogual/neovim-dot-app/tree/ime to have a look at some of this stuff.

tsukimizake commented 5 years ago

Hi. I'm trying to implement IME support for neovim-dot-app on my fork. (https://github.com/tsukimizake/neovim-dot-app) Basic Japanese input is already working, but there's one problem left. Marked text (text being passed to IME) should be shown inline, but I don't know how to implement it on neovim-dot-app.

For example, when I type 'こんにちわ', application should show it inline like this MacVim screenshot.

Screen Shot 2019-05-15 at 18 33 23

Although, my current implementation shows it like this. Even when whole 'こんにちわ' is typed, only half of the first character under cursor is seen. (Once I hit return key, 'こんにちわ' is inserted properly.)

Screen Shot 2019-05-15 at 18 29 06

Text to show is stored in mMarkedText variable and I want to show it inline. Maybe there should be some work on redraw.mm? I want to send a pull request when this bug is fixed. Is there some advice?

Thanks.