Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remappings not applying with operators that enter insert mode #3090

Merged

Conversation

shawnaxsom
Copy link
Contributor

What this PR does / why we need it:

#3081 handled allowing remapping black hole operator deletion, but this lead to a regression. It bypassed remapping for any operator in action, but it should still remap for any operator in action in normal mode.

For example,ciwjj with jj -> <Esc> mapping should result in cutting inner word, then exiting back to normal mode, but it does not. The remapping doesn't apply since the code is checking for an operator in recordedState; the whole ciwjj combination is a full recorded state, and therefore the "c" operator exists the whole time.

We should therefore be preventing "d" in "dd" normal mode from being remapped, as Vim seems to do, to allow black hole deletion remappings still. But we shouldn't prevent remappings if the operator puts us into e.g. Insert Mode.

Which issue(s) this PR fixes

fixes #3088

Special notes for your reviewer:

I refactored the remapper unit tests slightly. I added a test that only remapped what it was actually testing. This ensures other unconcerned remappings won't interefere, and it is also more explicit and understandable IMO. I preserved the setup logic for existing tests to use all remappings as before, though maybe we should be more explicit with those tests as well.

@xconverge xconverge merged commit 0b0bad5 into VSCodeVim:master Oct 5, 2018
@TravisBuddy
Copy link

Hey @shawnaxsom,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 4741ee20-c842-11e8-95f5-19ba20551b8b

@shawnaxsom shawnaxsom changed the title Remappings not applying when operators that enter insert mode Remappings not applying with operators that enter insert mode Oct 5, 2018
@shawnaxsom shawnaxsom deleted the bugfix/remap-operators-in-insert-mode branch October 5, 2018 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

custom <Esc> key binding "jj" stoped working when entering insert mode from "cw"
3 participants