update implementation, formatting

This commit is contained in:
Tanki Zhang 2019-10-09 23:18:47 -04:00
parent d5e39670b8
commit aaae35f42d

View File

@ -512,23 +512,21 @@ void vprint(std::FILE* f, const text_style& ts, const S& format,
} }
if (ts.has_foreground()) { if (ts.has_foreground()) {
has_style = true; has_style = true;
auto foreground = internal::make_foreground_color<Char>(ts.get_foreground()); auto foreground =
internal::make_foreground_color<Char>(ts.get_foreground());
buf.append(foreground.begin(), foreground.end()); buf.append(foreground.begin(), foreground.end());
} }
if (ts.has_background()) { if (ts.has_background()) {
has_style = true; has_style = true;
auto background = internal::make_background_color<Char>(ts.get_background()); auto background =
internal::make_background_color<Char>(ts.get_background());
buf.append(background.begin(), background.end()); buf.append(background.begin(), background.end());
} }
vformat_to(buf, format, args);
format_to( buf, "{}", format );
if (has_style) { if (has_style) {
reset_color( buf ); reset_color(buf);
} }
internal::fputs(buf.data(), f);
vprint(f, buf.data(), args);
} }
/** /**