Skip to content

fix: u should undo one action at a time, not entire stack#9982

Closed
SAY-5 wants to merge 2 commits intoVSCodeVim:masterfrom
SAY-5:fix/undo-single-action
Closed

fix: u should undo one action at a time, not entire stack#9982
SAY-5 wants to merge 2 commits intoVSCodeVim:masterfrom
SAY-5:fix/undo-single-action

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented Apr 12, 2026

Fixes #2007.

finishCurrentStep() in modeHandler.ts was gated on ranRepeatableAction, which only gets set for commands with createsUndoPoint, 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 — pressing u then undid everything at once.

The fix replaces the ranRepeatableAction check with ranAction && 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.

SAY-5 and others added 2 commits April 11, 2026 18:30
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
@SAY-5 SAY-5 closed this by deleting the head repository Apr 24, 2026
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.

Pressing u will undo all the stack.

2 participants