summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ui/tui.sh18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/ui/tui.sh b/src/ui/tui.sh
index 962e731..74211d7 100644
--- a/src/ui/tui.sh
+++ b/src/ui/tui.sh
@@ -252,19 +252,25 @@ tui_show_prompt()
case "${key}" in
KEY_ENTER) break;;
KEY_BACKSPACE)
- input="${input%?}"
- curpos=$(($curpos - 1))
+ if [ ${curpos} -gt 0 ]; then
+ input="${input%?}"
+ curpos=$(($curpos - 1))
+ fi
;;
KEY_DEL)
;;
# TODO: Line editing
KEY_SPACE)
- input="${input} "
- curpos=$(($curpos + 1))
+ if [ ${curpos} -lt ${len} ]; then
+ input="${input} "
+ curpos=$(($curpos + 1))
+ fi
;;
*)
- input="${input}${key}"
- curpos=$(($curpos + 1))
+ if [ ${curpos} -lt ${len} ]; then
+ input="${input}${key}"
+ curpos=$(($curpos + 1))
+ fi
;;
esac
elif [ ${focus} -eq 1 ]; then