We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello there!
I don't know if wide strings are intended to not be supported by color formatting, but it seems like a bug.
To put simply, this does not work:
fmt::print( fmt::fg( fmt::color::red ), L"This is a wide formatted string\n" );
If you look at this line here: https://github.com/fmtlib/fmt/blob/master/include/fmt/color.h#L415
It uses std::strlen and if you try to format a wide string with this, it fails to compile as std::strlen assumes 'char' is the type.
I've tried replacing it with this:
return buffer + std::char_traits<Char>::length(buffer);
This seems to work just fine for me. But I haven't done a whole lot of testing.
The text was updated successfully, but these errors were encountered:
Thanks for reporting. Could you submit a PR with your suggested fix and a test in test/color-test.cc?
test/color-test.cc
Sorry, something went wrong.
Use std::char_traits::length for ansi_color_escape::begin
6ec9543
-Fixes issue fmtlib#1594 fmtlib#1594
Color formatting fixed for wide strings (fixes issue #1594) (#1596)
2559983
* Use std::char_traits::length for ansi_color_escape::begin -Fixes issue #1594 #1594
42ac51d
* Use std::char_traits::length for ansi_color_escape::beGin -Fixes issue #1594 fmtlib/fmt#1594
No branches or pull requests
Hello there!
I don't know if wide strings are intended to not be supported by color formatting, but it seems like a bug.
To put simply, this does not work:
fmt::print( fmt::fg( fmt::color::red ), L"This is a wide formatted string\n" );
If you look at this line here: https://github.com/fmtlib/fmt/blob/master/include/fmt/color.h#L415
It uses std::strlen and if you try to format a wide string with this, it fails to compile as std::strlen assumes 'char' is the type.
I've tried replacing it with this:
return buffer + std::char_traits<Char>::length(buffer);
This seems to work just fine for me. But I haven't done a whole lot of testing.
The text was updated successfully, but these errors were encountered: