aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/commands.c b/commands.c
index 006e537c..dcf2a3f6 100644
--- a/commands.c
+++ b/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) {