1
0

fix: fix all old usage of UTF8 in std::ostream.

- use patch stream instead of all old use of UTF8 in std::ostream (reinterpret way).
This commit is contained in:
2025-09-28 21:37:05 +08:00
parent bd5032cee7
commit 8d7eff2a15
4 changed files with 18 additions and 21 deletions

View File

@ -1,13 +1,13 @@
#include "termcolor.hpp"
#include "../flag_enum.hpp"
#include "../string/reinterpret.hpp"
#include "../patch/stream.hpp"
#include <stdexcept>
#include <bit>
#define FLAG_ENUM ::yycc::flag_enum
#define REINTERPRET ::yycc::string::reinterpret
using namespace std::literals::string_view_literals;
using namespace yycc::patch::stream;
namespace yycc::carton::termcolor {
@ -213,7 +213,7 @@ namespace yycc::carton::termcolor {
}
void cprint(const std::u8string_view& words, Color foreground, Color background, Attribute styles, std::ostream& dst) {
dst << REINTERPRET::as_ordinary_view(colored(words, foreground, background, styles));
dst << colored(words, foreground, background, styles);
}
void ecprint(const std::u8string_view& words, Color foreground, Color background, Attribute styles) {