From f4f38939d56cae203b3566d22f40e4d792b19ddc Mon Sep 17 00:00:00 2001 From: unspeaker Date: Sun, 23 Mar 2025 23:27:45 +0200 Subject: [PATCH] clamp scroll --- src/keys.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/keys.rs b/src/keys.rs index 743b79b..735d997 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -57,7 +57,8 @@ impl Handle for Taggart { if self.cursor > x_max { self.offset += self.cursor - x_max; } - if self.offset > self.display.h() { + if self.offset > self.entries.len().saturating_sub(self.display.h()) { + self.offset = self.entries.len().saturating_sub(self.display.h()) } if self.cursor >= self.entries.len() { self.cursor = self.entries.len().saturating_sub(1)