Skip to content

Simplify undo stack#3

Merged
AlexMorson merged 2 commits intomainfrom
alex/refactor-undo
Jan 18, 2026
Merged

Simplify undo stack#3
AlexMorson merged 2 commits intomainfrom
alex/refactor-undo

Conversation

@AlexMorson
Copy link
Owner

While working on refactoring the application to be less dependent on the grid representation of inputs, I ran into trouble getting the undo stack working. This change should make the refactor easier.

Previously, the undo stack only stored the "commands" that were applied to update the state. This is memory efficient, but has become difficult to reason about. This new approach simply stores the entire state of the application before and after each action is taken. This will use a lot more memory, but this should be possible to optimise later if it turns out to be a problem.

Previously, the undo stack only stored the "commands" that were applied
to update the state. This is memory efficient, but has become difficult
to reason about. This new approach simply stores the entire state of the
application before and after each action is taken. This will use a lot
more memory, but this should be possible to optimise later if it turns
out to be a problem.
@AlexMorson AlexMorson merged commit 2303627 into main Jan 18, 2026
1 check passed
@AlexMorson AlexMorson deleted the alex/refactor-undo branch January 18, 2026 19:37
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