clamp scroll

This commit is contained in:
🪞👃🪞 2025-03-23 23:27:45 +02:00
parent 57b418b567
commit f4f38939d5

View file

@ -57,7 +57,8 @@ impl Handle<TuiIn> for Taggart {
if self.cursor > x_max { if self.cursor > x_max {
self.offset += 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() { if self.cursor >= self.entries.len() {
self.cursor = self.entries.len().saturating_sub(1) self.cursor = self.entries.len().saturating_sub(1)