Skip to content

Fix debug string formatting for range formatters - #4936

Merged
vitaut merged 1 commit into
fmtlib:mainfrom
cuishuang:main
Sep 11, 2026
Merged

Fix debug string formatting for range formatters#4936
vitaut merged 1 commit into
fmtlib:mainfrom
cuishuang:main

Conversation

@cuishuang

Copy link
Copy Markdown
Contributor

range_format::debug_string manually added quotes around the result of the underlying string formatter. This bypassed debug string escaping and caused width specifications to exclude the quotes.

For example, newline, quote, and backslash characters were emitted without the expected escaping, and {:8} could produce a result wider than eight columns.

Parse the underlying formatter first, enable its debug format for range_format::debug_string, and delegate formatting directly to it. This ensures that escaping, alignment, and width are handled consistently by the standard string formatter.

Signed-off-by: cuishuang <imcusg@gmail.com>
@cuishuang
cuishuang requested a review from vitaut as a code owner September 7, 2026 04:50
@vitaut
vitaut merged commit 6aa4a5f into fmtlib:main Sep 11, 2026
47 checks passed
@vitaut

vitaut commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Merged, thanks!

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