summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2024-08-28 21:54:21 -0400
committerAndrew Cady <d@jerkface.net>2024-08-28 21:54:21 -0400
commita68356432542c5a8e82442bd5fc0442dc43555c7 (patch)
treea4ad01b0e4a4c0a29eecb3f4f7928b06e736d813
parent600db046935b122d72f2b595f95649e41584cd81 (diff)
color fix
-rw-r--r--src/write-tty19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/write-tty b/src/write-tty
index 5de700a..60046e1 100644
--- a/src/write-tty
+++ b/src/write-tty
@@ -27,7 +27,7 @@ colorize()
27 declare -i c=16#"${REPLY#??}" 27 declare -i c=16#"${REPLY#??}"
28 ;; 28 ;;
29 * ) 29 * )
30 printf '%s\n' "$REPLY" 30 printf '0 %s\n' "$REPLY"
31 continue 31 continue
32 ;; 32 ;;
33 esac 33 esac
@@ -44,7 +44,7 @@ colorize()
44 then 44 then
45 REPLY=^$(chr c + 64) 45 REPLY=^$(chr c + 64)
46 fi 46 fi
47 printf $'\e[106m%s\e[m\n' "$REPLY" 47 printf '106 %s\n' "$REPLY"
48 done 48 done
49} 49}
50 50
@@ -102,10 +102,19 @@ soft_cursor()
102 echo -n "$0" >/proc/$BASHPID/comm 102 echo -n "$0" >/proc/$BASHPID/comm
103 FMT=$'\e[m %s\b%s\e[%sm \b\e[m' 103 FMT=$'\e[m %s\b%s\e[%sm \b\e[m'
104 REPLY= 104 REPLY=
105 color=105 105 declare -i replylen=0 replycolor
106 while printf "$FMT" "$(padding ${#REPLY})" "$REPLY" "$color" 106 promptcolor=105
107 while printf "$FMT" "$(padding $replylen)" "$REPLY" "$promptcolor"
107 do 108 do
108 read -r || break 109 read -r replycolor REPLY || break
110 replylen=${#REPLY}
111 case "$replycolor" in
112 0 )
113 ;;
114 * )
115 REPLY=$'\e['"$replycolor"'m'"$REPLY"$'\e[m'
116 ;;
117 esac
109 done 118 done
110} 119}
111 120