mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-25 06:46:36 -04:00
terminal: expand scrollback when scrolling
If configured to do so, expand the scrollback capacity in order to hold the new rows without losing past output.
This commit is contained in:
parent
800b7c423a
commit
c8c9d1bebe
1 changed files with 9 additions and 1 deletions
10
terminal.c
10
terminal.c
|
|
@ -2815,6 +2815,8 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows
|
|||
/* Verify scroll amount has been clamped */
|
||||
xassert(rows <= region.end - region.start);
|
||||
|
||||
bool expanded = term_expand_scrollback_capacity_if_needed(term, rows);
|
||||
|
||||
/* Cancel selections that cannot be scrolled */
|
||||
if (unlikely(term->selection.coords.end.row >= 0)) {
|
||||
/*
|
||||
|
|
@ -2838,7 +2840,13 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows
|
|||
|
||||
bool view_follows = term->grid->view == term->grid->offset;
|
||||
term->grid->offset += rows;
|
||||
term->grid->offset &= term->grid->num_rows - 1;
|
||||
if (!expanded) {
|
||||
/* Additional capacity was not allocated.
|
||||
* Clamp down the offset and wrap it around
|
||||
* so that old output lines are reused.
|
||||
*/
|
||||
term->grid->offset &= term->grid->num_rows - 1;
|
||||
}
|
||||
|
||||
if (likely(view_follows)) {
|
||||
term_damage_scroll(term, DAMAGE_SCROLL, region, rows);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue