From a1cea37cea5c74248ca625d68761f95a60a57848 Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Fri, 21 Jul 2017 12:25:17 +0000 Subject: [PATCH] Implement scrolling --- lib/main.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/main.rb b/lib/main.rb index c939e11..bd0557e 100644 --- a/lib/main.rb +++ b/lib/main.rb @@ -83,6 +83,12 @@ private @active += 1 @active = 0 if @active >= @items.count end + + if @active < @top + @top = @active + elsif @active >= @top + @height + @top = @active - @height + 1 + end end def render