summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Terminal.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Fl_Terminal.cxx b/src/Fl_Terminal.cxx
index 566cb0820..4e3c8e45d 100644
--- a/src/Fl_Terminal.cxx
+++ b/src/Fl_Terminal.cxx
@@ -3905,6 +3905,8 @@ int Fl_Terminal::handle(int e) {
free((void*)s); // free() the copy when done!
\endcode
+ \param[in] lines_below_cursor include lines below cursor, default: false
+
\return A string allocated with strdup(3) which must be free'd, text is UTF-8.
*/
const char* Fl_Terminal::text(bool lines_below_cursor) const {
@@ -3922,8 +3924,8 @@ const char* Fl_Terminal::text(bool lines_below_cursor) const {
const char *s = u8c->text_utf8(); // first byte of char
for (int i=0; i<u8c->length(); i++) lines += *s++; // append all bytes in multibyte char
// Count any trailing whitespace to trim
- if (u8c->length()==1 && *s==' ') trim++; // trailing whitespace? trim
- else trim = 0; // non-whitespace? don't trim
+ if (u8c->length()==1 && s[-1]==' ') trim++; // trailing whitespace? trim
+ else trim = 0; // non-whitespace? don't trim
}
// trim trailing whitespace from each line, if any
if (trim) lines.resize(lines.size() - trim);