summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-10-29 00:22:42 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-10-29 00:22:42 (EDT)
commitd973bd5b30cd1f030c128fac36c4b91963011c77 (patch)
treebfd3cbd22a89eca4882b0ae8a6167361207aa4a6
parentd19afb24c207c2324e93eb834439d468de7f0cdc (diff)
downloadfirman.sh-d973bd5b30cd1f030c128fac36c4b91963011c77.zip
firman.sh-d973bd5b30cd1f030c128fac36c4b91963011c77.tar.gz
firman.sh-d973bd5b30cd1f030c128fac36c4b91963011c77.tar.bz2
tui_show_prompt(): Handle arrow keys
-rw-r--r--src/ui/tui.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ui/tui.sh b/src/ui/tui.sh
index 74211d7..5c88f23 100644
--- a/src/ui/tui.sh
+++ b/src/ui/tui.sh
@@ -251,6 +251,16 @@ tui_show_prompt()
elif [ ${focus} -eq 0 ]; then
case "${key}" in
KEY_ENTER) break;;
+ KEY_LEFT)
+ if [ ${curpos} -gt 0 ]; then
+ curpos=$(($curpos - 1))
+ fi
+ ;;
+ KEY_RIGHT)
+ if [ ${curpos} -lt ${#input} ]; then
+ curpos=$(($curpos + 1))
+ fi
+ ;;
KEY_BACKSPACE)
if [ ${curpos} -gt 0 ]; then
input="${input%?}"
@@ -258,16 +268,20 @@ tui_show_prompt()
fi
;;
KEY_DEL)
+ if [ ${curpos} -lt ${#input} ]; then
+ : TODO
+ fi
;;
- # TODO: Line editing
KEY_SPACE)
if [ ${curpos} -lt ${len} ]; then
+ # TODO: Handle curpos not at end
input="${input} "
curpos=$(($curpos + 1))
fi
;;
*)
if [ ${curpos} -lt ${len} ]; then
+ # TODO: Handle curpos not at end
input="${input}${key}"
curpos=$(($curpos + 1))
fi