From ae3179090416c12c8891a5dc283b1426fbda045b Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 29 Oct 2015 16:41:49 -0400 Subject: tui_show_menu(): Fix scrolling --- diff --git a/src/ui/tui.sh b/src/ui/tui.sh index c96b607..9ed68f9 100644 --- a/src/ui/tui.sh +++ b/src/ui/tui.sh @@ -255,8 +255,9 @@ tui_show_menu() done # Draw labels. - i=0 + i=-1 for label in "${@}"; do + i=$(($i + 1)) [ ${i} -ge ${scrpos} ] || continue [ ${i} -lt $(($scrpos + $scrh)) ] || break if [ ${i} -eq ${curpos} ]; then @@ -276,7 +277,6 @@ tui_show_menu() $(($y + 4 + $i - $scrpos)) $(($x + 3)) term_write "${label}" fi - i=$(($i + 1)) done # Input. @@ -299,7 +299,7 @@ tui_show_menu() curpos=$(($curpos + 1)) if [ ${curpos} -ge $(($scrpos + \ $scrh)) ]; then - scrpos=$(($curpos + $scrh)) + scrpos=$(($curpos - $scrh + 1)) fi ;; KEY_HOME) -- cgit v0.9.1