summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/tui.sh21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/ui/tui.sh b/src/ui/tui.sh
index 85f2fe1..0aca904 100644
--- a/src/ui/tui.sh
+++ b/src/ui/tui.sh
@@ -203,6 +203,9 @@ tui_show_menu()
w=$(expr ${#label} + 6)
fi
done
+ if [ ${w} -lt 17 ]; then
+ w=17
+ fi
lsth=${#}
h=$(($lsth + 8))
if [ ${h} -gt $(term_lines) ]; then
@@ -229,8 +232,8 @@ tui_show_menu()
# Event loop.
while :; do
- # Draw a button.
- term_cursor_position $(($y + $h - 2)) $(($x + $w - 6))
+ # Draw buttons.
+ term_cursor_position $(($y + $h - 2)) $(($x + $w - 15))
if [ ${focus} -eq 1 ]; then
term_attr_on reverse
term_write '[OK]'
@@ -238,6 +241,14 @@ tui_show_menu()
else
term_write '[OK]'
fi
+ term_write ' '
+ if [ ${focus} -eq 2 ]; then
+ term_attr_on reverse
+ term_write '[Cancel]'
+ term_attr_off reverse
+ else
+ term_write '[Cancel]'
+ fi
# Draw a box.
term_cursor_position $(($y + 3)) $(($x + 2))
@@ -292,7 +303,7 @@ tui_show_menu()
# Input.
key="$(term_getch)"
if [ "x${key}" = xKEY_TAB ]; then
- focus=$(expr \( ${focus} + 1 \) % 2)
+ focus=$(expr \( ${focus} + 1 \) % 3)
elif [ ${focus} -eq 0 ]; then
case "${key}" in
KEY_ENTER) break;;
@@ -326,6 +337,10 @@ tui_show_menu()
case "${key}" in
KEY_ENTER | KEY_SPACE) break;;
esac
+ elif [ ${focus} -eq 2 ]; then
+ case "${key}" in
+ KEY_ENTER | KEY_SPACE) return 1;;
+ esac
fi
done