Add clear_screen manipulator

This commit is contained in:
Bob Polis 2025-02-13 08:02:39 +01:00
parent d6ac23e5ae
commit aad373a5b5
2 changed files with 7 additions and 0 deletions

View File

@ -46,6 +46,12 @@ std::ostream& sc::io::show_cursor(std::ostream& out) {
return out;
}
std::ostream& sc::io::clear_screen(std::ostream& out) {
if (should_color(out))
out << "\x1b" << 'c';
return out;
}
std::ostream& sc::io::reset(std::ostream& out) {
if (should_color(out))
out << "\x1b[m";

View File

@ -11,6 +11,7 @@ namespace sc {
std::ostream& hide_cursor(std::ostream& out);
std::ostream& show_cursor(std::ostream& out);
std::ostream& clear_screen(std::ostream& out);
std::ostream& reset(std::ostream& out);
std::ostream& bold(std::ostream& out);