Snapshot the whole edit in the history, so a drawn mask can be taken back
The undo stack snapshotted a `Preset` — the parameter map — and a mask layer is deliberately not a parameter. So drawing one changed nothing the history could see: `record` returned `false`, no step opened, and the layer the photographer had just painted had no way back. The interface went on calling `record` in good faith, including from the mask controls, and nothing failed. A film stock went missing the same way. The snapshot is an `EditState` now, so the history is complete by construction rather than by anyone keeping a list in their head. `undo` and `redo` return a `Step` rather than a `bool`. Stepping is not the only outcome a caller has to act on — a step across a change of film leaves the graph without its tables, and only the caller can bake them — and a `bool` would let that be dropped by writing nothing at all, which is the shape of mistake this module had already made once. `DevelopSession` settles the debt either way; a step that found nowhere to go is left alone, since clearing the film because undo hit the floor would take the stock off the picture. Five tests, all of which fail against the old snapshot: a drawn layer is undoable and redoable, a layer's own settings are a step of their own, a change of stock is a step and names what it needs baked back, clearing the film is undoable, and an exposure move does not deep-copy the mask stack. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -259,10 +259,10 @@ fn undo_takes_a_repair_back() {
|
||||
assert!(history.record(&graph, Edit::Discrete));
|
||||
assert_eq!(graph.spots().len(), 1);
|
||||
|
||||
assert!(history.undo(&mut graph));
|
||||
assert!(history.undo(&mut graph).moved());
|
||||
assert_eq!(graph.spots().len(), 0, "the repair is still on the frame");
|
||||
|
||||
assert!(history.redo(&mut graph));
|
||||
assert!(history.redo(&mut graph).moved());
|
||||
assert_eq!(graph.spots().len(), 1, "and redo could not put it back");
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ fn undo_steps_back_through_a_moved_source() {
|
||||
.set_offset((0.2, 0.1));
|
||||
history.record(&graph, Edit::Discrete);
|
||||
|
||||
assert!(history.undo(&mut graph));
|
||||
assert!(history.undo(&mut graph).moved());
|
||||
assert_eq!(
|
||||
graph.spots().get(&id).map(|s| s.offset),
|
||||
Some((0.08, 0.0)),
|
||||
|
||||
Reference in New Issue
Block a user