diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2022-10-14 16:00:48 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2022-10-16 08:31:08 +0000 |
| commit | 3d9a429499841cca83b5c8359ea7e2b78509601f (patch) | |
| tree | 7cb90bc377a7f42aa92637e3d4f7f36a5fbb3ffb | |
| parent | sixel: don’t crash when sixel image exceeds current sixel max height (diff) | |
term: reverse scroll: free scrolled out lines
This ensures *everything* in the circular scrollback history, after
the bottom of the screen, is either NULL rows, or belong to the
scrollback *history* (as opposed to the future history).
This fixes an issue when calculating the scrollback start, which for
example would trigger a crash when moving the viewport (i.e. scrolling
with the mouse, or PgUp/PgDown).
Closes #1190
| -rw-r--r-- | terminal.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -2676,6 +2676,18 @@ term_scroll_reverse_partial(struct terminal *term, selection_scroll_down(term, rows); } + /* Unallocate scrolled out lines */ + for (int r = region.end - rows; r < region.end; r++) { + const int abs_r = grid_row_absolute(term->grid, r); + struct row *row = term->grid->rows[abs_r]; + + grid_row_free(row); + term->grid->rows[abs_r] = NULL; + + if (term->render.last_cursor.row == row) + term->render.last_cursor.row = NULL; + } + sixel_scroll_down(term, rows); bool view_follows = term->grid->view == term->grid->offset; |
