summaryrefslogtreecommitdiff
path: root/src/Fl_Terminal.cxx
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2023-11-16 14:58:49 -0800
committerGreg Ercolano <erco@seriss.com>2023-11-16 15:45:29 -0800
commit38fc08c15f5f4dca0b5987bbae326bf8f5468aa5 (patch)
tree2f45e3b4b6061410cb3dfb607f811a9a12bcde99 /src/Fl_Terminal.cxx
parent01d30ed9cc4c080dea45ee85ec7af76cbd7e61bb (diff)
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.
Diffstat (limited to 'src/Fl_Terminal.cxx')
-rw-r--r--src/Fl_Terminal.cxx19
1 files changed, 19 insertions, 0 deletions
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
@@ -1591,6 +1591,25 @@ int Fl_Terminal::xy_to_glob_rowcol(int X, int Y, int &grow, int &gcol) const {
}
/**
+ 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.
Also clears the current mouse selection.