diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/tui.sh | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ui/tui.sh b/src/ui/tui.sh index 6cf0f9f..34c3a61 100644 --- a/src/ui/tui.sh +++ b/src/ui/tui.sh @@ -262,10 +262,17 @@ tui_show_prompt() fi ;; KEY_BACKSPACE) - if [ ${curpos} -gt 0 ]; then - input="${input%?}" - curpos=$(($curpos - 1)) - fi + [ ${curpos} -gt 0 ] || continue + i=1 + mask='' + while [ ${i} -lt ${curpos} ]; do + mask="${mask}." + i=$(($i + 1)) + done + cmd="s/^\\(${mask}\\).\\(.*\\)\$/\1\2/" + input="$(printf '%s' "${input}" | sed \ + "${cmd}")" + curpos=$(($curpos - 1)) ;; KEY_DEL) [ ${curpos} -lt ${#input} ] || continue |