Repository navigation
Character and Paragraph Styles: a new style's name is trimmed as a rename trims it - #2726
Merged
bflatastic merged 2 commits intoOct 17, 2026
Merged
Conversation
4 tasks done
…name trims it charStyle.new and paraStyle.new kept the name they were given as it was, while charStyle.rename and paraStyle.rename trim the white space around the new name. So a script could make a style " Body" beside "Body", and a blank name was refused with the message for a name that is taken. New Character Style and New Paragraph Style now trim the name as rename does, compare the trimmed name with the styles there are, and refuse a name that is then empty with rename's message. Duplicate names the copy from the trimmed name. symbol.new and symbol.duplicate trim the name as symbol.options trims newName, and a blank newName gives "<name> copy" instead of a symbol named with the blank. library.use adds a library's text style under its trimmed name, so a library file whose style is named with spaces around it still applies. Docs: docs/mcp.md, docs/target-app-parity.md.
bflatastic
force-pushed
the
fix/style-names-trimmed-on-create
branch
from
October 17, 2026 18:56
5f9388b to
f5d61f6
Compare
Member
|
Thanks @dotCooCoo, merged. One commit on top: a blank new style name now says "give the style a name" instead of the empty-name/already-used message. 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
charStyle.newandparaStyle.newkept the name they were given as it was, whilecharStyle.renameandparaStyle.renametrim the white space around the new name. SocharStyle.new {name: " Body"}made a style " Body" beside "Body", and a blank name was refused with the message for a name that is taken. The reference app's Character Styles and Paragraph Styles panels make a style with Create New Style (Character and paragraph styles). The page does not say what happens to white space around a name, so this change uses the rule of VectorCraft's renames.charStyle.newandparaStyle.newtrim the name asrenamedoes (crates/engine/src/cmd/textstyles.rs:553), compare the trimmed name with the styles there are, and refuse a name that is then empty with rename's message, "`` is empty or already used".charStyle.duplicateand `paraStyle.duplicate` name the copy from the trimmed name.symbol.newandsymbol.duplicatehad the same fault:symbol.optionstrimsnewName(crates/engine/src/cmd/brushsym.rs:701), and they now trim the name in the same way. A blank name gives "New Symbol" as before, and a blanknewNamegives " copy" instead of a symbol named with the blank.library.useadds a library's text style under its trimmed name, so a library file whose style is named " Body " still applies.docs/mcp.mddescribes the trimming in the symbols bullet and the Libraries paragraph, anddocs/target-app-parity.mdhas one line for it. The change adds no message or label, so the catalogs do not change.A script that makes a style or symbol with white space around its name now gets the name without it.
How it was tested
New tests, each failing on
main:cmd::textstyles::tests::new_styles_trim_their_names_as_a_rename_does(vectorcraft-engine): both kinds of style, the duplicate check on the trimmed name, a blank name, and Duplicate of a style whose saved name has spaces around ittests_brushsym::new_and_duplicate_symbols_trim_their_names_as_a_rename_does(vectorcraft-engine): New Symbol and Duplicate Symbol with spaced and blank namestests_library::a_library_style_named_with_spaces_comes_in_trimmed(vectorcraft-engine): an imported library's spaced character and paragraph styles applied withlibrary.useTargeted checks on the final tree:
cargo clippy -p vectorcraft-engine --all-targets -- -D warnings; the new tests and the other tests intextstyles,tests_brushsym,tests_libraryandparams;cargo fmt --all -- --check;cargo xtask brands,layersandassets.On Windows 11 (x86-64) with rustc 1.99.1, on top of
mainat f5511df:CRAFT_FONTS_DIR=<craft-fonts checkout> cargo xtask cipasses its 10 steps: 7,853 tests passed, 0 failed, 11 ignored.git merge-treereports no conflicts withmainat f5511df or at f7de3d6; merged with f7de3d6, the style, symbol and library tests pass. #1942 already conflicts withmaininbrushsym.rs. With this branch, itssymbol_newhunk also takes in thenameline; the resolution keeps this branch's trimmednameline and #1942'sdynamicline.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.