diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-05-19 16:47:38 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-05-19 16:47:38 +0000 |
| commit | 550667a9ea9edcec3071a1d7ec7c868aa7c791ad (patch) | |
| tree | 749ddb57d46f3d8a27b583fdceef8c531c14a78a /terminal.c | |
| parent | readme: add suggested cflags for a release build (diff) | |
term: scrolling: calling function must clamp scroll amount
Diffstat (limited to 'terminal.c')
| -rw-r--r-- | terminal.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1744,8 +1744,8 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows LOG_DBG("scroll: rows=%d, region.start=%d, region.end=%d", rows, region.start, region.end); - /* Clamp scroll amount */ - rows = min(rows, region.end - region.start); + /* Verify scroll amount has been clamped */ + assert(rows <= region.end - region.start); /* Cancel selections that cannot be scrolled */ if (unlikely(term->selection.start.row != -1)) { @@ -1816,8 +1816,8 @@ term_scroll_reverse_partial(struct terminal *term, LOG_DBG("scroll reverse: rows=%d, region.start=%d, region.end=%d", rows, region.start, region.end); - /* Clamp scroll amount */ - rows = min(rows, region.end - region.start); + /* Verify scroll amount has been clamped */ + assert(rows <= region.end - region.start); /* Cancel selections that cannot be scrolled */ if (unlikely(term->selection.start.row != -1)) { |
