Skip to content

Implement Multi-Step Undo#10294

Open
neumannt wants to merge 2 commits intoCard-Forge:masterfrom
neumannt:undo
Open

Implement Multi-Step Undo#10294
neumannt wants to merge 2 commits intoCard-Forge:masterfrom
neumannt:undo

Conversation

@neumannt
Copy link
Copy Markdown

@neumannt neumannt commented Apr 5, 2026

This pull request implements multi-step undo by pressing Ctrl-Z, guarded behind the experimental snapshot flag. It consists of two patches:

  1. it fixes the snapshot mechanism to really keep track of all state (and adds a test that explicitly checks that all state is covered). Some state was not covered correctly, e.g., number of card draws, speed, etc.
  2. uses the mechanism for multi-step undo, by keeping the last 10 states available in a list and going to the previous state if requested.

Claude Code helped with creating the patch, and was used to check if all state was covered in the snapshot mechanism. I manually tested state reconstruction with complex card states, e.g., planeswalkers. The old code was definitively incorrect/incomplete, and the whole feature is disabled by default, thus it should be an improvement for sure.

neumannt added 2 commits April 5, 2026 13:24
This commit adds support for the missing state fields when creating
a snapshot, and adds a test to make sure that in the future new state
is not forgotten in the snapshot mechanism.
When the experimental snapshot mechanism is enabled, the UI now allows
for undoing the last 10 operations with Ctrl+Z.
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.

1 participant