Repository navigation
Records an undo step for a change of the current layer, colour, lineweight or linetype - #3555
Merged
HakanSeven12 merged 2 commits intoNov 24, 2026
Merged
Conversation
…eight or linetype With nothing selected, the ribbon and the Properties palette set the current value of the drawing and added no undo step. UNDO then kept the new value and took back the step before it. The four functions now call push_undo_snapshot before the change. The lineweight message of the palette calls on_ribbon_lineweight_changed, as the other three palette messages call their functions. Co-Authored-By: Claude
8 cases in the undo sweep: the current layer, colour, lineweight and linetype, from the Properties palette and from the ribbon, with nothing selected. Co-Authored-By: Claude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change summary
With nothing selected, the layer, colour, lineweight and linetype controls of the Properties palette and of the ribbon set the current value of the drawing (
$CLAYER,$CECOLOR,$CELWEIGHT,$CELTYPE). That change added no undo step.So UNDO after such a change did two wrong things: it kept the new value, and it took back the step before it. A user who drew a line, changed the current layer and pressed Ctrl+Z lost the line and kept the layer.
The reference application takes back each of the four changes with UNDO (tested there by hand).
With this change each of the four is one undo step.
What specifically changed
Two commits: the fix, then its test.
src/app/update/command/properties.rs:on_ribbon_layer_changed,on_ribbon_color_changed,on_ribbon_lineweight_changedandon_ribbon_linetype_changedcallpush_undo_snapshotbefore they change the header. The Properties palette calls the same functions when nothing is selected.src/app/update/dispatch.rs,Message::PropLwChanged: with nothing selected it wrote the header itself. It now callson_ribbon_lineweight_changed, as the other three palette messages do.src/app/undo_sweep_tests.rs:current_value_cases(8 cases: the four values, from the palette and from the ribbon) and the testevery_change_of_a_current_value_is_undone_and_redone_exactly.Why
Testing
On main
32e30c8b3.cargo test --workspace --locked --no-fail-fast,cargo check --workspace --all-targets, clippy, the wasm32 check, rustfmt on the changed files, the golden file): 7,882 passed and 0 failed before; 7,883 passed and 0 failed after. The 1 new test is the only difference. Warnings, the wasm32 check, clippy, rustfmt and the golden file are the same.cargo mutantson the diff: 20 mutants, all 20 did not compile, so the run says nothing.Not covered
CLAYER Walls,-LAYER S Walls,CECOLOR 1and-LINETYPE S Continuouseach add 0 undo steps (I ran them through the same sweep check). They set the header in other functions.LAYMCUR, a restored layer state, and a plugin.Impact to Contributors
None.
#3553 (the undo record guard) is built on this branch, so the two can merge in either order.
Co-Authored-By: Claude