mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-10 04:27:45 -05:00
scrollback: fix scrolling outside initialized lines in new terminal
This commit is contained in:
parent
7594edb89b
commit
d8d4b34362
1 changed files with 10 additions and 0 deletions
10
commands.c
10
commands.c
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue