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

Support color printing strings with zero bytes #1356

Closed
wants to merge 1 commit into from

Conversation

orivej
Copy link
Contributor

@orivej orivej commented Oct 10, 2019

This is a clean up after #1351.

@@ -503,8 +503,7 @@ void vprint(std::FILE* f, const text_style& ts, const S& format,
basic_format_args<buffer_context<Char> > args) {
basic_memory_buffer<Char> buf;
internal::vformat_to(buf, ts, to_string_view(format), args);
buf.push_back(Char(0));
internal::fputs(buf.data(), f);
std::fwrite(buf.data(), 1, buf.size(), f);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To handle wchar_t correctly on Windows this should be fputws if Char is wchar_t (#1243). This will truncate output on NUL chars but I don't think we should worry about this. Also use fwrite_fully for char to handle I/O errors.

@vitaut
Copy link
Contributor

vitaut commented Oct 18, 2019

Closing because, as commented earlier, I think we should continue using fputws for wchar_t.

@vitaut vitaut closed this Oct 18, 2019
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