/ oni2 Public
fix(vim/#2413): Visual-in motion (viw/vi"/etc) not working correctly #2429
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge.
Issue: Visual motions - like
vi"are not working as expected.
Defect: At first, I thought this might be an issue in
libvim- so I added a test case in onivim/libvim#223 - surprisingly, it passed, but the same set of keystrokes was not working as expected in Onivim.
I checked the logging I added for onivim/libvim#223, and the code path that handles the 'in' motion in visual mode wasn't being hit. It turns out, our terminal key-bindings are incorrectly defined, and were getting engaged in this case (since we manage terminal insert <-> normal transition in Onivim, we have keybindings that handle keys like 'i', but there were getting engaged in the
vi"case, even though they shouldn't).
Fix: Scope the insert-mode transition keys (i/a/etc) to only the case where the terminal is focused and we're in normal mode. Move them to be local to the terminal feature.