[vte] emulation: Ensure the cursor remains onscreen when moving down



commit ef0734c1eb775cf98db9a6e8e87700830b1a3890
Author: Egmont Koblinger <egmont gmail com>
Date:   Tue Sep 24 13:01:54 2019 +0200

    emulation: Ensure the cursor remains onscreen when moving down
    
    Previously the cursor could escape from the onscreen area, resulting in
    a crash. This happened when a scrolling area was defined which did not
    include the bottom row, the cursor was in the terminal's bottom row and
    moved downwards from there.
    
    https://gitlab.gnome.org/GNOME/vte/issues/176

 src/vte.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 1f926511..45d480c8 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2706,8 +2706,9 @@ Terminal::cursor_down(bool explicit_sequence)
                        VteRowData *rowdata = ensure_row();
                         _vte_row_data_fill (rowdata, &m_color_defaults, m_column_count);
                }
-       } else {
-               /* Otherwise, just move the cursor down. */
+        } else if (m_screen->cursor.row < m_screen->insert_delta + m_row_count - 1) {
+                /* Otherwise, just move the cursor down; unless it's already in the last
+                 * physical row (which is possible with scrolling region, see #176). */
                 m_screen->cursor.row++;
        }
 }


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