Skip to content

Fix debug format width calculation - #4902

Open
Satyakam-Mishra wants to merge 1 commit into
fmtlib:mainfrom
Satyakam-Mishra:fix-debug-width-4901
Open

Fix debug format width calculation#4902
Satyakam-Mishra wants to merge 1 commit into
fmtlib:mainfrom
Satyakam-Mishra:fix-debug-width-4901

Conversation

@Satyakam-Mishra

Copy link
Copy Markdown

Fixes #4901.

The width calculation for debug-formatted characters and strings was based on the unescaped output size. This caused incorrect padding for debug characters and could truncate the closing quote for empty debug strings.

This change:

  • Calculates the formatted size of debug characters using the escaped representation.
  • Correctly accounts for the closing quote of an empty debug string when width/precision permits it.
  • Adds regression tests for both cases.

All tests pass locally.

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.

{:N?} miscomputes the width of debug-escaped output

1 participant