[vte] widget: Change last-line newline behaviour of get_text()



commit 16e7d6bb139cc37c9ccdd6124e18752f53d50ed5
Author: Christian Persch <chpe gnome org>
Date:   Tue Dec 15 20:38:42 2015 +0100

    widget: Change last-line newline behaviour of get_text()
    
    To get all the text on the last line to the right, you can either
    pass m_column_count (or MAXLONG), *or* add 1 to the end row, and
    pass -1 as last column. Make it so that the difference between these
    is that the former does *not* append a final newline character,
    while the latter does append a final newline character.
    
    This fixes a frequent assert in vte_terminal_accessible_text_scrolled(),
    but the assertion in that function will need to be fixed, too, since
    it appears the assert can be triggered in other ways too.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759319

 src/vte.cc |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index d226648..016d3a7 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -6124,7 +6124,7 @@ VteTerminalPrivate::get_text(vte::grid::row_t start_row,
                }
                /* Else, if the last visible column on this line was in range and
                 * not soft-wrapped, append a newline. */
-               else if (m_column_count <= line_last_column) {
+               else if (row < end_row) {
                        /* If we didn't softwrap, add a newline. */
                        /* XXX need to clear row->soft_wrap on deletion! */
                        if (!line_is_wrappable(row)) {
@@ -6161,7 +6161,7 @@ VteTerminalPrivate::get_text_displayed(bool wrap,
                                        GArray *attributes)
 {
         return get_text(first_displayed_row(), 0,
-                        last_displayed_row(), m_column_count - 1,
+                        last_displayed_row() + 1, -1,
                         false /* block */, wrap, include_trailing_spaces,
                         attributes);
 }
@@ -6175,7 +6175,7 @@ VteTerminalPrivate::get_text_displayed_a11y(bool wrap,
                                             GArray *attributes)
 {
         return get_text(m_screen->scroll_delta, 0,
-                        m_screen->scroll_delta + m_row_count - 1, m_column_count - 1,
+                        m_screen->scroll_delta + m_row_count - 1 + 1, -1,
                         false /* block */, wrap, include_trailing_spaces,
                         attributes);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]