Repository navigation
Conversation
…y open Using a library's character or paragraph style, and scrubbing a numeric field, closed their undo step with Session::end_undo_group, which closes the open undo group of every document. An undo group open in another document, such as one begun with edit.undoGroup.begin for an MCP command_batch with atomic, was closed too, and that document's next edits became undo steps of their own. When the style failed to apply, or Escape ended the scrub, the other document's group was canceled as well and the edits made in it were undone. Inside an undo group already open in the same document, a scrub closed that group, Escape undid the edits made in it before the drag, and a style that failed to apply left the style it had added. Session::begin_undo_scope and end_undo_scope make the edits in between one undo step of the active document: the scope opens an undo group there, or joins the one already open. Ending a scope closes only the group it opened, in its own document, even when another document became active in the meantime, and a canceled scope undoes only its own edits, also inside a group that was already open. library.use and the scrub use the scope, so Escape inside an open group also takes back a scrub of the Transform panel's Shear field. edit.undoGroup.end still closes the open group of every document.
Contributor
4 tasks done
This branch has not been deployed
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.
What and why
Using a library's character or paragraph style (
library.use) and scrubbing a numeric field each make one undo step by opening an undo group in the active document. Both closed it withSession::end_undo_group, which closes the open undo group of every document. So an undo group open in another document, such as one begun withedit.undoGroup.beginfor an MCPcommand_batchwithatomic, was closed too, and that document's next edits became undo steps of their own. When the style failed to apply, or Escape ended the scrub, the other document's group was canceled as well, and the edits made in it were undone. Inside an undo group already open in the same document, a scrub closed that group, Escape undid the edits made in it before the drag, and a style that failed to apply left the style it had added.Session::begin_undo_scopeandSession::end_undo_scopemake the edits in between one undo step of the active document. The scope opens an undo group there, or joins the group already open, so that its edits are part of that group's step.edit.undoGroup.end(end_undo_group) still closes the open group of every document.library.usewith a character or paragraph style, and a field scrub, use the scope. Escape during a scrub inside an open group puts the document back as it was before the drag, also for the Transform panel's Shear field, whose value rests at 0°.How it was tested
New tests, each failing on
main:tests_journal::an_undo_scope_closes_only_its_own_documents_groupandan_undo_scope_in_an_open_group_takes_back_only_its_own_edits(vectorcraft-engine) end and cancel scopes with groups open in two documents, once while the other document is active, and inside an open group before and after its first edit, checking the groups, the undo steps and the journal. They do not build onmain, which has no undo scopes.tests_library::a_library_style_leaves_another_documents_undo_group_open(vectorcraft-engine) uses a style in one document and draws in the other, whose edit must join its open group's step.tests_library::a_library_style_that_fails_takes_back_only_its_own_editsanda_library_style_that_fails_in_an_open_group_takes_back_its_own_edits(vectorcraft-engine) apply a paragraph style with nothing selected, in a second document and inside the group's own document. The style it added is taken back, and the group stays open with the rectangle drawn in it.tests_scrub::a_scrub_leaves_another_documents_undo_group_open,a_scrub_inside_an_open_undo_group_joins_its_stepanda_scrub_closes_its_group_in_its_own_document_after_a_switch(vectorcraft-ui-egui) scrub W with Escape and with a release while another document has an open group, inside the document's own open group, and with another document made active during the drag.Targeted checks on the final tree:
cargo clippy -p <crate> --all-targets -- -D warningson vectorcraft-engine and vectorcraft-ui-egui; the new tests and the existingtests_scrub,tests_libraryandan_undo_group_is_one_undo_steptests;cargo fmt --all -- --check;cargo xtask brands,layersandassets.On Windows 11 (x86-64) with rustc 1.99.1, on top of
mainatbc1ae082:CRAFT_FONTS_DIR=<craft-fonts checkout> cargo xtask cipasses its 10 steps: 8,578 tests passed, 0 failed, 13 ignored.git merge-treereports no conflicts withmainatbc1ae082.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md.Summary by CodeRabbit
Bug Fixes
Tests