aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-03 12:15:46 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-03 12:15:46 +0000
commit1f343527f065352f34af06d8d6a7cbd3e6c82cb5 (patch)
tree3bee22b6dd0f73038f4a2244b60a756381cc3457
parentscrolling: hopefully fix bad damage update of items outside scrolling region (diff)
scrolling: make sure we don't clear too much memory
-rw-r--r--terminal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/terminal.c b/terminal.c
index df74e9db..49c8e390 100644
--- a/terminal.c
+++ b/terminal.c
@@ -272,7 +272,9 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows
/* Clear scrolled-in lines */
grid_memset(
term->grid,
- max(0, region.end - rows) * term->cols, 0, rows * term->cols);
+ max(0, region.end - rows) * term->cols,
+ 0,
+ min(rows, term->rows) * term->cols);
term_damage_scroll(term, DAMAGE_SCROLL, region, rows);