summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)