Repository navigation
Fix MTEXT paragraph property codes leaking into plain text - #83
Merged
mahach666 merged 2 commits intoDec 6, 2026
Merged
Conversation
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 changes and why
MTEXT uses uppercase
\Pfor a paragraph break and lowercase\p...;for paragraph formatting (indentation, alignment and tabs). The latter currently inserts a newline and leaves the formatting arguments visible in plain text, including scene annotations.This change strips terminated paragraph properties without introducing an extra newline. If the terminator is missing before another formatting command, group or line break, the literal code is preserved rather than swallowing the following text. Raw
Textis unchanged.How it was checked
Added five cases covering documented paragraph properties, actual line breaks, CAD Unicode escapes, escaped literals, and an unterminated command. Each verifies the raw string, PlainText and scene annotation.
On base
56db8485, three cases failed and two passed on both .NET 8 and .NET 10.After the fix:
dotnet test tests/DwgIO.Tests/DwgIO.Tests.csproj -c Release --no-restore -m:1passed 314 tests per framework (3 skipped each). No native AutoCAD run or before/after drawing-wide JSON/inspect comparison was performed; the intended output difference is the corrected plain annotation text.dotnet build DwgIO.slnx -c Releasehas no warnings (solution-wide build not run separately)dotnet testpassesJSON exports and
dwgio inspectoutput of the same drawings before and after are identical, or the differences are listed and intendedThe change is original work; no code or text is copied from other projects
No drawings, customer data, vendor code or binaries are added
Reference: Autodesk developer blog: MTEXT formatting codes.