From 4d102e069e4a0b6064a79915d368773338dbbb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 3 May 2021 23:04:54 +0200 Subject: dont scroll too far Closes #11 --- src/window.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/window.rs') diff --git a/src/window.rs b/src/window.rs index 68fc258..3714c4c 100644 --- a/src/window.rs +++ b/src/window.rs @@ -57,9 +57,10 @@ impl Window { Ok(()) } - pub fn scroll_down(&mut self) { - //TODO check if we're at bottom - self.scroll += 1; + pub fn scroll_down(&mut self, until: usize) { + if self.scroll < until - 1 { + self.scroll += 1; + } } pub fn scroll_up(&mut self) { -- cgit v1.2.1