Skip to content

fix: undo counted changes in one step#39

Merged
oribarilan merged 2 commits into
oribarilan:mainfrom
hamidi-dev:fix/counted-change-undo
Jun 17, 2026
Merged

fix: undo counted changes in one step#39
oribarilan merged 2 commits into
oribarilan:mainfrom
hamidi-dev:fix/counted-change-undo

Conversation

@hamidi-dev

Copy link
Copy Markdown
Contributor

Summary

Fixes undo behavior for counted changes like 3dw.

Details

Previously, counted destructive motions could require multiple u presses because each repeated command became its own editor undo step. This adds a single pre-change snapshot for counted delete/change operations so one u restores the full buffer state.

Covered cases include:

  • 3dw
  • 2cw
  • 3dd

Comment thread src/index.ts Outdated
Comment thread test/vim.test.ts
@oribarilan

Copy link
Copy Markdown
Owner

awesome stuff!! thanks

@hamidi-dev hamidi-dev force-pushed the fix/counted-change-undo branch from 92e174b to 35a2e3b Compare June 16, 2026 17:52
@hamidi-dev

Copy link
Copy Markdown
Contributor Author

all done :-)

@oribarilan oribarilan merged commit 1bea5e2 into oribarilan:main Jun 17, 2026
1 check passed
oribarilan added a commit that referenced this pull request Jun 17, 2026
The comment in `applyActions` still described the old single-snapshot
logic after #39 changed it to a batch-flag mechanism. Updated to reflect
how `keepUndoSnapshotForBatch` actually works.
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.

2 participants