From b941676fe7a11af4bfdf3bde99ca597c32dea7d0 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Fri, 30 Aug 2024 10:10:11 -0400 Subject: fix unicode non-printing --- src/write-tty | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/write-tty') diff --git a/src/write-tty b/src/write-tty index 60046e1..7403006 100644 --- a/src/write-tty +++ b/src/write-tty @@ -71,12 +71,7 @@ tokenize() then printf '\\%.3o\n' "'$REPLY" else - hexdigits=$(LC_ALL=C; for ((i=0; i<$bytelen; ++i)) - do - printf '%.2x' "'${REPLY:$i:1}" - printf '%.2x\n' "'${REPLY:$i:1}" >&2 - done) - printf '%s%.8x\n' '\U' 0x"$hexdigits" + printf '\\U%.8x\n' "'$REPLY" fi else printf '\\%.3o\n' 0 @@ -108,14 +103,12 @@ soft_cursor() do read -r replycolor REPLY || break replylen=${#REPLY} - case "$replycolor" in - 0 ) - ;; - * ) - REPLY=$'\e['"$replycolor"'m'"$REPLY"$'\e[m' - ;; - esac + if (( $replycolor > 0 )) + then + printf -v REPLY '\e[%sm%s\e[m' "$replycolor" "$REPLY" + fi done + printf ' \b\n' } output_filter -- cgit v1.2.3