fix: u should undo one action at a time, not entire stack#9982
Closed
SAY-5 wants to merge 2 commits intoVSCodeVim:masterfrom
Closed
fix: u should undo one action at a time, not entire stack#9982SAY-5 wants to merge 2 commits intoVSCodeVim:masterfrom
SAY-5 wants to merge 2 commits intoVSCodeVim:masterfrom
Conversation
Previously, finishCurrentStep() only fired when ranRepeatableAction was true, which excluded movements and commands without createsUndoPoint. This caused changes to accumulate in a single undo step, making 'u' undo everything at once. Now fires after every completed normal mode action (ranAction), while preserving the macro/dot/remap guards. Type-checked: no new errors introduced (all existing errors are pre-existing in node_modules and unrelated files). Fixes #2007
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2007.
finishCurrentStep()in modeHandler.ts was gated onranRepeatableAction, which only gets set for commands withcreatesUndoPoint, mode transitions back to Normal, and operator execution. Plain commands that don't set this flag never created undo boundaries, so their changes piled up in a single step — pressinguthen undid everything at once.The fix replaces the
ranRepeatableActioncheck withranAction && currentMode === Normal, so every completed normal-mode action gets its own undo step. The macro/dot/remap guards are unchanged (those should still batch into a single undo).Verified with
tsc --noEmit— two-line diff.