From f8a7e299b03365a5526f787f7e5504cd09ec83e0 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Fri, 9 May 2025 09:29:10 -0700 Subject: Fl_Terminal doc fixes, private->protected for utf8_char_at_*() --- src/Fl_Terminal.cxx | 59 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/Fl_Terminal.cxx b/src/Fl_Terminal.cxx index f68668b1e..74aa02161 100644 --- a/src/Fl_Terminal.cxx +++ b/src/Fl_Terminal.cxx @@ -911,8 +911,8 @@ void Fl_Terminal::RingBuffer::scroll(int rows, const CharStyle& style) { // // Example: // // Walk ALL rows in the ring buffer.. -// for (int row=0; rowxxx() methods.. } } @@ -1111,6 +1116,19 @@ Fl_Terminal::Utf8Char* Fl_Terminal::u8c_hist_row(int hrow) aren't many (or any) rows in the history buffer that have been populated with scrollback text yet. + Example to walk all "in use" lines of the history buffer: + \code + // Walk the entire screen history ("in use") and display to stdout + for (int row=0; rowlength(), u8c->text_utf8()); // show each utf8 char to stdout + } + ::printf("\n"); // end of each line + } + \endcode + \see u8c_disp_row(int) for example use. */ Fl_Terminal::Utf8Char* Fl_Terminal::u8c_hist_use_row(int hurow) @@ -1130,6 +1148,21 @@ Fl_Terminal::Utf8Char* Fl_Terminal::u8c_hist_use_row(int hurow) ::printf("<%.*s>", len, text); // print potentially multibyte char } \endcode + + - This can also be used to walk all rows on the display screen up to the cursor row, e.g. + \code + // Write all chars in display up to cursor row to stdout + for (int row=0; rowtext_utf8(), u8c->length()); // write each utf8 char to stdout + } + ::printf("\n"); + } + \endcode + + \see u8c_hist_use_row() for examples of walking the screen history */ Fl_Terminal::Utf8Char* Fl_Terminal::u8c_disp_row(int drow) { return const_cast(const_cast(this)->u8c_disp_row(drow)); } @@ -3925,7 +3958,7 @@ int Fl_Terminal::handle(int e) { /** Return a string copy of all lines in the terminal (including history). - The returned string is allocated with strdup(3), which the caller must free. + The returned string is allocated with `strdup(3)`, which the caller must `free(3)`. If \p 'lines_below_cursor' is false (default), lines below the cursor on down to the bottom of the display are ignored, and not included in the returned string. -- cgit v1.2.3