summaryrefslogtreecommitdiff
path: root/src/write-tty
diff options
context:
space:
mode:
Diffstat (limited to 'src/write-tty')
-rw-r--r--src/write-tty16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/write-tty b/src/write-tty
index 62ff4f4..5de700a 100644
--- a/src/write-tty
+++ b/src/write-tty
@@ -84,14 +84,26 @@ tokenize()
84 done 84 done
85} 85}
86 86
87padding()
88{
89 for ((i=0; i<$1; ++i))
90 do
91 echo -n ' '
92 done
93 for ((i=0; i<$1; ++i))
94 do
95 echo -en '\b'
96 done
97}
98
87soft_cursor() 99soft_cursor()
88{ 100{
89 BASH_ARGV0=soft_cursor 101 BASH_ARGV0=soft_cursor
90 echo -n "$0" >/proc/$BASHPID/comm 102 echo -n "$0" >/proc/$BASHPID/comm
91 FMT=$'%s \b\e[%sm \e[m \b\b' 103 FMT=$'\e[m %s\b%s\e[%sm \b\e[m'
92 REPLY= 104 REPLY=
93 color=105 105 color=105
94 while printf "$FMT" "$REPLY" "$color" 106 while printf "$FMT" "$(padding ${#REPLY})" "$REPLY" "$color"
95 do 107 do
96 read -r || break 108 read -r || break
97 done 109 done