summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-10-29 16:41:49 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-10-29 16:41:49 (EDT)
commitae3179090416c12c8891a5dc283b1426fbda045b (patch)
treee6c53102deaebbdd78eb0fd6c61482cdfff917bf
parent1bfd71ff4fcd391d3d84cd713bbaa44090d5e883 (diff)
downloadfirman.sh-ae3179090416c12c8891a5dc283b1426fbda045b.zip
firman.sh-ae3179090416c12c8891a5dc283b1426fbda045b.tar.gz
firman.sh-ae3179090416c12c8891a5dc283b1426fbda045b.tar.bz2
tui_show_menu(): Fix scrolling
-rw-r--r--src/ui/tui.sh6
1 files changed, 3 insertions, 3 deletions
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)