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)