Skip to content
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

Merged
merged 2 commits into from
May 15, 2020

Conversation

rimathia
Copy link
Contributor

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

@rimathia
Copy link
Contributor Author

addresses #1682

@@ -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;
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@vitaut
Copy link
Contributor

vitaut commented May 14, 2020

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
Copy link
Contributor Author

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').

@vitaut vitaut merged commit 96c18b2 into fmtlib:master May 15, 2020
@vitaut
Copy link
Contributor

vitaut commented May 15, 2020

Thanks!

@rimathia
Copy link
Contributor Author

Thanks to you for getting to it so quickly.

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