Clear with buffer clear

This commit is contained in:
eried 2020-06-28 20:06:00 +02:00
parent d175e33990
commit ddffc69937
2 changed files with 6 additions and 6 deletions

View file

@ -570,7 +570,10 @@ Console::Console(
{ {
} }
void Console::clear() { void Console::clear(bool clear_buffer = false) {
if(clear_buffer)
buffer.clear();
display.fill_rectangle( display.fill_rectangle(
screen_rect(), screen_rect(),
Color::black() Color::black()
@ -595,10 +598,7 @@ void Console::write(std::string message) {
pen_color = s.foreground; pen_color = s.foreground;
escape = false; escape = false;
} else { } else {
if (c=='\f') { //Add FORM FEED (clear screen) if (c == '\n') {
clear();
buffer.clear();
} else if (c == '\n') {
crlf(); crlf();
} else if (c == '\x1B') { } else if (c == '\x1B') {
escape = true; escape = true;

View file

@ -312,7 +312,7 @@ class Console : public Widget {
public: public:
Console(Rect parent_rect); Console(Rect parent_rect);
void clear(); void clear(bool clear_buffer);
void write(std::string message); void write(std::string message);
void writeln(std::string message); void writeln(std::string message);