scrollback: fix scrolling outside initialized lines in new terminal

This commit is contained in:
Daniel Eklöf 2019-07-10 14:28:20 +02:00
parent 7594edb89b
commit d8d4b34362
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -29,6 +29,16 @@ cmd_scrollback_up(struct terminal *term, int rows)
while (!term->grid->rows[new_view]->initialized)
new_view = (new_view + 1) % term->grid->num_rows;
if (new_view == term->grid->view) {
/*
* This happens when scrolling up in a newly opened terminal;
* every single line (except those already visible) are
* uninitalized, and the loop above will bring us back to
* where we started.
*/
return;
}
/* Don't scroll past scrollback history */
int end = (term->grid->offset + term->rows - 1) % term->grid->num_rows;
if (end >= term->grid->offset) {