Added iomanip to clear term line

This commit is contained in:
Bob Polis 2022-11-01 09:52:22 +01:00
parent 1629622bff
commit 408c99271d
2 changed files with 20 additions and 0 deletions

View File

@ -66,3 +66,12 @@ cursor_hider::cursor_hider(std::ostream* out) : _out {out} {
cursor_hider::~cursor_hider() { cursor_hider::~cursor_hider() {
*_out << io::show_cursor; *_out << io::show_cursor;
} }
// ------------------------------------------------------------------------
sc::io::clear_line::clear_line(const term& t) : _term {t} {}
std::ostream& sc::io::operator<<(std::ostream& out, const sc::io::clear_line& obj) {
out << '\r' << std::string(obj._term.cols(), ' ') << '\r';
return out;
}

View File

@ -33,6 +33,17 @@ namespace sc {
~cursor_hider(); ~cursor_hider();
}; };
namespace io {
class clear_line {
const term& _term;
public:
clear_line(const term& t);
friend std::ostream& operator<<(std::ostream& out, const clear_line& obj);
};
}
} }
#endif // UTILS_H_ #endif // UTILS_H_