From 095d36109fee0a7bd43d17f07bf9c4b751876caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Fri, 10 Jan 2025 16:51:04 -0500 Subject: [PATCH] Fix scrolling when there's no scrollbar. The code was moving unscrolled lines back after scrolling the majority of them... if all lines were scrolled, moving some back actually broke scrolling. --- src/conio/bitmap_con.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c index b41ec9844d..ff0fabbe90 100644 --- a/src/conio/bitmap_con.c +++ b/src/conio/bitmap_con.c @@ -1392,11 +1392,18 @@ bitmap_movetext_screen(int x, int y, int tox, int toy, int direction, int height if (screena.toprow < 0) screena.toprow += screena.screenheight; + /* + * Set up to move bits that were *not* moved back to + * where they should have stayed. + */ if (direction == -1) direction = 1; else direction = -1; height = vstat.rows - height; + // If everything was moved, there's no lines to move back + if (height <= y - toy) + return; int otoy = toy; toy = vstat.rows - (y - toy); y = toy - (y - otoy); -- GitLab