-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make plus flag for printf not be ignored for char argument #1683
Conversation
addresses #1682 |
include/fmt/printf.h
Outdated
@@ -257,7 +257,7 @@ class printf_arg_formatter : public detail::arg_formatter_base<Range> { | |||
return (*this)(static_cast<int>(value)); | |||
fmt_specs.sign = sign::none; | |||
fmt_specs.alt = false; | |||
fmt_specs.align = align::right; | |||
if (fmt_specs.align == align::numeric) fmt_specs.align = align::right; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure which possible values of align really have to be overwritten here. align::numeric is the one case where a test fails if it isn't overwritten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be align::none
, not align::numeric
, because none is the default and here we are trying to change the default to right alignment.
Thanks for the PR! |
@@ -257,7 +257,10 @@ class printf_arg_formatter : public detail::arg_formatter_base<Range> { | |||
return (*this)(static_cast<int>(value)); | |||
fmt_specs.sign = sign::none; | |||
fmt_specs.alt = false; | |||
fmt_specs.align = align::right; | |||
// align::numeric needs to be overwritten here since the '0' flag is | |||
// ignored for non-numeric types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test which is affected from not overwriting align::numeric here is EXPECT_PRINTF("0000x", "%05c", 'x').
Thanks! |
Thanks to you for getting to it so quickly. |
I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.