From e350936d8237acd4fef88f6492be5b7e02aa4bbe Mon Sep 17 00:00:00 2001 From: Ales Musil Date: Thu, 21 Jan 2021 13:18:36 +0100 Subject: [PATCH] Fix underflow in scrolling When window was smaller than whole display scrolling by small step could cause underflow in the offset computation. --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index c796aa1..69058e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -225,7 +225,7 @@ where scroller.top_offset += num_lines; if scroller.top_offset > (scroller.height - scroller.fixed_bottom_lines) { scroller.top_offset = scroller.fixed_top_lines - + (scroller.top_offset - scroller.height + scroller.fixed_bottom_lines) + + (scroller.top_offset + scroller.fixed_bottom_lines - scroller.height) } self.command(