jupyterlab-vim icon indicating copy to clipboard operation
jupyterlab-vim copied to clipboard

Mode-switching sometimes breaks insert mode

Open SnoopJ opened this issue 6 years ago • 3 comments

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.

SnoopJ avatar Mar 20 '18 20:03 SnoopJ

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

jwkvam avatar Mar 23 '18 00:03 jwkvam

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!

SnoopJ avatar Mar 23 '18 03:03 SnoopJ

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?

raulf2012 avatar Dec 21 '19 22:12 raulf2012