scrolling: fix crash when offset was exactly at the wrap-around

When making sure we don't scroll past the scrollback history, and the
current offset was exactly at the wrap around, the new view port was
set to offset+1, which in this particular case meant outside the valid
row numbers.
This commit is contained in:
Daniel Eklöf 2020-05-19 18:51:56 +02:00
parent 8ad3b9c172
commit 483ea4ae73
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 5 additions and 2 deletions

View file

@ -48,10 +48,10 @@ cmd_scrollback_up(struct terminal *term, int rows)
if (end >= term->grid->offset) {
/* Not wrapped */
if (new_view >= term->grid->offset && new_view <= end)
new_view = end + 1;
new_view = (end + 1) % term->grid->num_rows;
} else {
if (new_view >= term->grid->offset || new_view <= end)
new_view = end + 1;
new_view = (end + 1) % term->grid->num_rows;
}
while (term->grid->rows[new_view] == NULL)