Skip to content

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

Description

@advitrocks9
fmt::print("[{:1?}]\n", std::string(""));  // ["]        missing the closing quote
fmt::print("[{:6?}]\n", 'a');              // ['a'     ] padded to 8, not 6

The width is computed from the size before escaping, so debug output pads wrong, and for an
empty string the closing quote gets truncated. std::format prints [""] and ['a' ].

Happy to put up a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions