🐛 fix abnormal debugger output on windows
This commit is contained in:
parent
07a652cc37
commit
f7f4a38b47
|
@ -10,11 +10,8 @@ struct for_reset {
|
||||||
for_reset() {
|
for_reset() {
|
||||||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &scr);
|
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &scr);
|
||||||
}
|
}
|
||||||
static for_reset* singleton() {
|
|
||||||
static for_reset windows_set;
|
|
||||||
return &windows_set;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
static for_reset windows_system_set;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::ostream& back_white(std::ostream& s) {
|
std::ostream& back_white(std::ostream& s) {
|
||||||
|
@ -64,8 +61,10 @@ std::ostream& white(std::ostream& s) {
|
||||||
|
|
||||||
std::ostream& reset(std::ostream& s) {
|
std::ostream& reset(std::ostream& s) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
|
SetConsoleTextAttribute(
|
||||||
for_reset::singleton()->scr.wAttributes);
|
GetStdHandle(STD_OUTPUT_HANDLE),
|
||||||
|
windows_system_set.scr.wAttributes
|
||||||
|
);
|
||||||
#else
|
#else
|
||||||
s << "\033[0m";
|
s << "\033[0m";
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue