Remappings not applying with operators that enter insert mode #3090
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.
Suggestion cannot be applied right now. Please check back later.
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
withjj -> <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.