auto-pairs icon indicating copy to clipboard operation
auto-pairs copied to clipboard

IME Japanese input mode is turned off when a specific key is entered

Open yoshida-m-3 opened this issue 3 years ago • 5 comments

Entering the backspace or enter key turns off IME Japanese input. The problem is limited to countries such as Asia that need to switch languages.

Is it possible to prevent IME Japanese input from being turned off due to unintended movement?

Also, disabling the plugin with <m-p> does not fix the problem. Removing the plugin itself solves this, but I want to continue using this plugin.

yoshida-m-3 avatar Sep 20 '21 06:09 yoshida-m-3

Possibly related to #334

What key causes the conflict?

LunarWatcher avatar Sep 20 '21 07:09 LunarWatcher

The two keys I'm seeing the problem with are backspace and enter.

You can see how the IME display at the bottom right switches without permission. Display A when IME mode is OFF When IME mode is ON, is displayed.

https://user-images.githubusercontent.com/48209986/133999035-aeeb3d9b-c7c0-47b0-9507-b74576ce7e4b.mov

yoshida-m-3 avatar Sep 20 '21 12:09 yoshida-m-3

For good measure, can you let g:AutoPairsMapBS = 0 and check if Japanese mode still gets turned off when you press backspace? I don't understand what could cause this - auto-pairs shouldn't emit anything that leaves Vim. What keybind do you use to switch to and from Japanese mode?

LunarWatcher avatar Sep 20 '21 12:09 LunarWatcher

Setting let g: AutoPairsMapBS = 0 no longer turns off the IME when pressing Backspace.

I'm sorry, and I noticed. I have defined a command in autocmd to turn off IME on InsertLeave. In the Japanese input environment, it is often customary to turn off the IME automatically.

yoshida-m-3 avatar Sep 20 '21 12:09 yoshida-m-3

Ahh, that explains it. <CR> directly uses escape. Not sure why backspace is triggered though, there's no escape involved there.

At worst, I can add a variable to keep track of "fake" normal mode (i.e. when normal mode is caused by the plugin temporarily). I've just found out about <C-c> though (https://vi.stackexchange.com/a/27196/21251), but that might not be recommended. I need to do some further research into this, but if I can find a way to exit insert mode in the mappings that doesn't trigger InsertLeave, I can fix this properly. Got no timeline on this though

LunarWatcher avatar Sep 20 '21 13:09 LunarWatcher