Skip to content

Stop auto-merge folding an edit into a saved command - #85

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/undoredo-84-no-merge-across-save
Sep 26, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
claude/undoredo-84-no-merge-across-save

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #84

What was wrong

UndoRedoService.Execute merged the first mergeable edit after MarkAsSaved() into the saved command. CleanupInvalidBoundaries then removed the save boundary, so Undo skipped past the saved state and the stack reported unsaved changes at every position.

Change

  • The auto-merge path now also requires that no save boundary sits at the current position. It uses a private IsAtSaveBoundary helper, so there is no public API change.
  • Two regression tests:
    • CommandMerging_AfterMarkAsSaved_KeepsTheSaveBoundary is the issue's repro. It expects two commands and one boundary, 'a' after Undo, and a clean stack.
    • CommandMerging_AfterMarkAsSaved_MergesLaterEditsWithEachOther shows that edits made after the save still merge with each other.

Verification

  • Full suite on this branch: 59/59 pass.
  • With the fix reverted, both new tests fail and the other 57 pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_016ToeUpj3nH61YEnatKdb8d


Generated by Claude Code

The first mergeable edit after MarkAsSaved merged into the saved
command, and CleanupInvalidBoundaries then dropped the boundary, so
Undo could never return to the saved state. Skip merging when a save
boundary sits at the current position.

Fixes #84

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ToeUpj3nH61YEnatKdb8d
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 60aa7e3 into main Sep 26, 2026
12 checks passed
@matt-edmondson
matt-edmondson deleted the claude/undoredo-84-no-merge-across-save branch September 26, 2026 09:53
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.

The first edit after MarkAsSaved auto-merges into the saved command, deleting the save boundary so Undo can never return to the saved state

2 participants