Repository navigation
Brushes, patterns and artboards: new and renamed items have their names trimmed - #2746
Merged
bflatastic merged 1 commit intoOct 17, 2026
Conversation
Merged
4 tasks done
…es trimmed
brush.new, brush.duplicate, object.pattern.make,
object.pattern.saveCopy, artboard.new and artboard.setProps kept the
name they were given as it was, and brush.options and pattern.options
kept the white space around a new name. So a script could make a brush
" Nib" beside "Nib", and a blank name made a brush, a pattern or an
artboard named with the blank. Artboard Options sends its Name field
as typed, so clearing it named the artboard "". The Brush Options
dialog, the Pattern Options panel and the Artboards panel trim the
names they send.
The eight commands now trim the name, and the brush and pattern
commands compare the trimmed name with the names there are. In
brush.new, brush.duplicate, object.pattern.make,
object.pattern.saveCopy and artboard.new, a blank name gives the name
the command gives when there is none: "New Calligraphic Brush" and the
other default brush names, "<name> copy", "New Pattern N",
"<pattern> copy" and "Artboard N". brush.options and pattern.options
keep the name when the new one is blank, and artboard.setProps gives a
blank one the artboard's default name, Artboard N for the Nth
artboard. Duplicate Brush and Save a Copy name the copy of a brush or
pattern whose saved name has white space around it from the trimmed
name (" Old " gives "Old copy").
Docs: docs/mcp.md, docs/target-app-parity.md.
bflatastic
force-pushed
the
fix/brush-pattern-artboard-names-trimmed
branch
from
October 17, 2026 18:56
3986baa to
3fe8aa7
Compare
Member
|
Thanks @dotCooCoo, merged. It went through the full gate (fmt, clippy, tests, layers, wasm) in today's batch. |
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
brush.new,brush.duplicate,object.pattern.make,object.pattern.saveCopy,artboard.newandartboard.setPropskept the name they were given as it was, andbrush.optionsandpattern.optionskept the white space around a new name. Sobrush.new {type: "calligraphic", name: " Nib"}made a brush " Nib" beside "Nib", and a blank name made a brush, a pattern or an artboard named with the blank. Artboard Options sends its Name field as typed, so clearing it named the artboard "". The Brush Options dialog, the Pattern Options panel and the Artboards panel already trim the names they send. The reference app names brushes in Brush Options (Brushes) and patterns in Pattern Options (Create and edit patterns), and for artboards it says "To return to the default name, clear the name of the artboard from the Name field in the Properties panel or the Control panel" (Using multiple artboards). This change gives a blank name the default name inartboard.newandartboard.setProps, which Artboard Options runs; the Properties and Control bar Name fields still keep the name when cleared. The pages do not say what happens to white space around a name, so this change uses the rule of VectorCraft's own dialogs and panels.symbol.optionstrimsnewName(crates/engine/src/cmd/brushsym.rs:711), the idiom Character and Paragraph Styles: a new style's name is trimmed as a rename trims it #2726 uses forsymbol.newandsymbol.duplicate, and the brush and pattern commands compare the trimmed name with the names there are.<name>copy", "New Pattern N", "<pattern>copy" and "Artboard N".brush.optionsandpattern.optionskeep the name, andartboard.setPropsgives the artboard its default name, Artboard N for the Nth artboard.docs/mcp.mdand one line indocs/target-app-parity.mddescribe the rule. The change adds no message or label, so the catalogs do not change. Layer names are not changed.A script that makes or renames a brush, a pattern or an artboard with white space around its name now gets the name without it, and clearing the name in Artboard Options gives the artboard its default name instead of an empty one.
How it was tested
New tests, each failing on
main:tests_brushsym::new_duplicate_and_renamed_brushes_trim_their_names(vectorcraft-engine): New Brush, Duplicate Brush and Brush Options with spaced and blank names, the duplicate check on the trimmed name, and Duplicate of a brush whose saved name has spaces around ittests_pattern::made_copied_and_renamed_patterns_trim_their_names(vectorcraft-engine): Make, Save a Copy and Pattern Options with spaced and blank names, the numbering and duplicate check on the trimmed name, and Save a Copy of a pattern whose saved name has spaces around ittests_panelcmds::new_and_renamed_artboards_trim_their_names(vectorcraft-engine):artboard.newandartboard.setPropswith spaced and blank namesTargeted checks on the final tree:
cargo clippy -p vectorcraft-engine --all-targets -- -D warnings; the new tests and the other tests intests_brushsym,tests_pattern,tests_panelcmdsandparams;cargo fmt --all -- --check;cargo xtask brands,layersandassets.On Windows 11 (x86-64) with rustc 1.99.1, on top of
mainatf7de3d6:CRAFT_FONTS_DIR=<craft-fonts checkout> cargo xtask cipasses its 10 steps: 7,929 tests passed, 0 failed, 11 ignored.git merge-treereports no conflicts withmainatf7de3d6. With #2592, #2403, #2532 and #2038, theartboard_newhunk conflicts with their change to theArtboardliteral on the next line. The resolution keeps this branch's twonamelines and the pull request'sArtboardline (merged with #2592 and resolved that way, the three new tests and the engine's 103 other tests withartboardin their names pass).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.