aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--commands.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b7256188..20e7730b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@
* Number of lines to scroll is now always clamped to the number of
lines in the scrolling region..
+
### Deprecated
### Removed
### Fixed
@@ -36,6 +37,8 @@
when the mouse button is released - not as soon as `shift` is
released.
* Selected cells did not appear selected if modified.
+* Rare crash when scrolling and the new viewport ended up **exactly**
+ on the wrap around.
* Selection handling when viewport wrapped around.
diff --git a/commands.c b/commands.c
index 2727c1f2..e199e4f4 100644
--- a/commands.c
+++ b/commands.c
@@ -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)