Files
wordcraft/crates/engine
Mat Strange 688fedc677 #4001: an undo group whose first command changed nothing keeps its step
A group of commands that run as one undo step — a dialog's OK, the frames of a
drag — has a step only once something in it changes. When the group's first
command changed nothing, the no-op path put that step back, so the commands
that joined it had nothing to merge into: their changes were not undoable and
the undo depth did not grow. That is the Page Setup test failure CI hit, which
only shows with the font checkout CI builds with.

The session now tracks whether the group has a step (`join_anchor`): the
dispatch pushes one for a joined command when it has none, and a no-op or
rejected command that puts its own step back leaves the group without one.

A command that changes nothing also leaves the unsaved-changes flag as it was,
even when the command calls `Session::touch()` itself.

And the no-op test uses the session's `replaces_document` indicator as well as
the document identity: `review.compare` with an `original` replaces the
document in place, without `set_document`, so two identical comparisons
produce the same document and the same identity.

Tests: `a_joined_command_starts_its_group_when_the_first_changed_nothing`,
`a_repeated_comparison_is_still_an_edit`, and the dirty check in
`a_command_that_changes_nothing_is_not_an_edit`.
2026-10-23 16:42:29 +01:00
..
2026-10-22 01:48:25 +00:00