summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/tui.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/ui/tui.sh b/src/ui/tui.sh
index 0aca904..ffd3430 100644
--- a/src/ui/tui.sh
+++ b/src/ui/tui.sh
@@ -371,6 +371,9 @@ tui_show_prompt()
if [ $(expr ${len} + 7) -gt ${w} ]; then
w=$(expr ${len} + 7)
fi
+ if [ ${w} -lt 17 ]; then
+ w=17
+ fi
read -r y x <<-EOF
$(_tui_box ${w} 9)
EOF
@@ -393,7 +396,7 @@ tui_show_prompt()
# Event loop.
while :; do
# Draw a button.
- term_cursor_position $(($y + 7)) $(($x + $w - 6))
+ term_cursor_position $(($y + 7)) $(($x + $w - 15))
if [ ${focus} -eq 1 ]; then
term_attr_on reverse
term_write '[OK]'
@@ -401,6 +404,14 @@ tui_show_prompt()
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 textbox.
term_cursor_position $(($y + 3)) $(($x + 2))
@@ -425,7 +436,7 @@ tui_show_prompt()
# 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)
@@ -522,6 +533,10 @@ tui_show_prompt()
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