From cf009fd11e03eab0732d06deb839909f0e989e20 Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Fri, 21 Jul 2017 12:20:31 +0000 Subject: [PATCH] Fix bug --- lib/main.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/main.rb b/lib/main.rb index 8109536..c939e11 100644 --- a/lib/main.rb +++ b/lib/main.rb @@ -92,14 +92,16 @@ private Curses.setpos 0, 0 Curses.addstr "items: #{@items.count}, height: #@height, active: #@active, top: #@top" - @items.each_with_index.to_a[@top...(@top + @height)].each do |item, index| + @items[@top...(@top + @height)].each_with_index.each do |item, offset| + index = @top + offset + if index == @active Curses.attron Curses.color_pair 2 else Curses.attron Curses.color_pair 1 end - Curses.setpos 1 + index, 0 + Curses.setpos 1 + offset, 0 Curses.addstr "#{index}: #{item}".ljust Curses.stdscr.maxx end