Skip to content

Brushes, patterns and artboards: new and renamed items have their names trimmed - #2746

Merged
bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/brush-pattern-artboard-names-trimmed
Oct 17, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/brush-pattern-artboard-names-trimmed

Conversation

@dotCooCoo

Copy link
Copy Markdown
Contributor

What and why

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 brush.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 in artboard.new and artboard.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.

  • The eight commands trim the name as symbol.options trims newName (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 for symbol.new and symbol.duplicate, and the brush and pattern commands compare the trimmed name with the names there are.
  • A blank name gives the name the command gives when there is none: the brush type's default name, "<name> copy", "New Pattern N", "<pattern> copy" and "Artboard N". brush.options and pattern.options keep the name, and artboard.setProps gives the artboard its 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").
  • The params text of the brush and pattern commands, docs/mcp.md and one line in docs/target-app-parity.md describe 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 it
  • tests_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 it
  • tests_panelcmds::new_and_renamed_artboards_trim_their_names (vectorcraft-engine): artboard.new and artboard.setProps with spaced and blank names

Targeted checks on the final tree: cargo clippy -p vectorcraft-engine --all-targets -- -D warnings; the new tests and the other tests in tests_brushsym, tests_pattern, tests_panelcmds and params; cargo fmt --all -- --check; cargo xtask brands, layers and assets.

On Windows 11 (x86-64) with rustc 1.99.1, on top of main at f7de3d6:

  • CRAFT_FONTS_DIR=<craft-fonts checkout> cargo xtask ci passes its 10 steps: 7,929 tests passed, 0 failed, 11 ignored.

git merge-tree reports no conflicts with main at f7de3d6. With #2592, #2403, #2532 and #2038, the artboard_new hunk conflicts with their change to the Artboard literal on the next line. The resolution keeps this branch's two name lines and the pull request's Artboard line (merged with #2592 and resolved that way, the three new tests and the engine's 103 other tests with artboard in their names pass).

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md.

…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
bflatastic force-pushed the fix/brush-pattern-artboard-names-trimmed branch from 3986baa to 3fe8aa7 Compare October 17, 2026 18:56
@bflatastic
bflatastic merged commit facab88 into storytold:main Oct 17, 2026
@bflatastic

Copy link
Copy Markdown
Member

Thanks @dotCooCoo, merged. It went through the full gate (fmt, clippy, tests, layers, wasm) in today's batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants