From 38fc08c15f5f4dca0b5987bbae326bf8f5468aa5 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Thu, 16 Nov 2023 14:58:49 -0800 Subject: Added clear(), some methods protected->public New public methods: void clear(void); void clear(Fl_Color val); old protected methods made public: void clear_screen(bool scroll_to_hist=true); // ESC [ 2 J void clear_screen_home(bool scroll_to_hist=true); // ESC [ H ESC [ 2 J void cursor_home(void); // ESC [ 0 H test/terminal modified to test these, and added separate tests for both the API and ANSI code ways to do these ops. --- src/Fl_Terminal.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/Fl_Terminal.cxx b/src/Fl_Terminal.cxx index 75d174750..b9489edae 100644 --- a/src/Fl_Terminal.cxx +++ b/src/Fl_Terminal.cxx @@ -1590,6 +1590,25 @@ int Fl_Terminal::xy_to_glob_rowcol(int X, int Y, int &grow, int &gcol) const { return x_to_glob_col(X, grow, gcol); } +/** + Clears the screen to the current textbgcolor(), and homes the cursor. + \see clear_screen(), clear_screen_home(), cursor_home() +*/ +void Fl_Terminal::clear(void) { + clear_screen_home(); +} + +/** + Clears the screen to a specific color \p val and homes the cursor. + \see clear_screen(), clear_screen_home(), cursor_home() +*/ +void Fl_Terminal::clear(Fl_Color val) { + Fl_Color save = textbgcolor(); + textbgcolor(val); + clear_screen_home(); + textbgcolor(save); +} + /** Clear the terminal screen only; does not affect the cursor position. -- cgit v1.2.3