From ddffc69937264be83031d7b916169d0180dab423 Mon Sep 17 00:00:00 2001 From: eried <1091420+eried@users.noreply.github.com> Date: Sun, 28 Jun 2020 20:06:00 +0200 Subject: [PATCH] Clear with buffer clear --- firmware/common/ui_widget.cpp | 10 +++++----- firmware/common/ui_widget.hpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/firmware/common/ui_widget.cpp b/firmware/common/ui_widget.cpp index c4c035a6..01639e0c 100644 --- a/firmware/common/ui_widget.cpp +++ b/firmware/common/ui_widget.cpp @@ -570,7 +570,10 @@ Console::Console( { } -void Console::clear() { +void Console::clear(bool clear_buffer = false) { + if(clear_buffer) + buffer.clear(); + display.fill_rectangle( screen_rect(), Color::black() @@ -595,10 +598,7 @@ void Console::write(std::string message) { pen_color = s.foreground; escape = false; } else { - if (c=='\f') { //Add FORM FEED (clear screen) - clear(); - buffer.clear(); - } else if (c == '\n') { + if (c == '\n') { crlf(); } else if (c == '\x1B') { escape = true; diff --git a/firmware/common/ui_widget.hpp b/firmware/common/ui_widget.hpp index e4b8533b..61ffeb72 100644 --- a/firmware/common/ui_widget.hpp +++ b/firmware/common/ui_widget.hpp @@ -312,7 +312,7 @@ class Console : public Widget { public: Console(Rect parent_rect); - void clear(); + void clear(bool clear_buffer); void write(std::string message); void writeln(std::string message);