jwkvam / jupyterlab-vim

:neckbeard: Vim notebook cell bindings for JupyterLab
MIT License
973 stars 73 forks source link

Mode-switching sometimes breaks insert mode #31

Open SnoopJ opened 6 years ago

SnoopJ commented 6 years ago

Per a request on Twitter, I'm opening an issue about sometimes getting a particular cell stuck in insert mode. I don't yet have a reliable set of repro steps, but it seems to happen when I'm frequently switching between vim-insert mode and normal mode. Sometimes I do this with SHIFT-ESC, sometimes I chain ESC to SHIFT-ESC. Might be some kind of race condition?

Once the buggy behavior begins, a cell appears stuck in insert mode (can type new lines), but has strange behaviors when deleting or some keys (i.e. p) that have special behavior in another mode.

I'll report back if I figure out how to consistently cause it, and welcome any input about how I can provide better information about how this happens.

jwkvam commented 6 years ago

Thanks for reporting! Right now there's a hack to try and keep codemirror in vim command mode when entering a cell [1]. I know odd behavior can happen when pressing shift-esc while in insert mode then focusing the cell jumps back to vim insert mode. I wouldn't be surprised if it's somehow related to that. I'll try to come up with a better way to handle that and maybe that will resolve this issue. I'll keep an eye out for this going forward.

[1] https://github.com/jwkvam/jupyterlab_vim/blob/9a3262db96e26b1d5a00d8479dcff64ebb54e5d4/src/index.ts#L70

SnoopJ commented 6 years ago

I know odd behavior can happen when pressing shift-esc while in insert mode then focusing the cell jumps back to vim insert mode. I wouldn't be surprised if it's somehow related to that.

This actually sounds like a pretty thorough description of the problem I'm having, although I do find that in this "insert" mode I can still trigger strange behaviors like a paste. Kinda like being half in insert mode, half in command.

Thanks for the hack!

raulf2012 commented 4 years ago

Hello is there any updates on this issue? I have this problem periodically (can't reproduce consistently)

Can somebody please explain how to implement the "hack"? Does it involve building the extension manually as opposed to installing with the jupyter labextension install jupyterlab_vim command?