Swap to a portable way of getting the ascii size'

This commit is contained in:
Dylan 2016-03-29 18:17:30 +11:00
parent a1d409046a
commit 47eba49457
1 changed files with 1 additions and 5 deletions

View File

@ -1857,14 +1857,10 @@ getascii () {
ascii_strip=${ascii_strip//\\}
# Get length of longest line
ascii_size=($(wc -lL 2>/dev/null <<< "$ascii_strip"))
ascii_size=($(awk 'END {print NR}length>max{max=length}END{print max}' <<< "$ascii_strip"))
ascii_height=${ascii_size[0]}
ascii_length=${ascii_size[1]}
# Fallback to using awk on systems without 'wc -L'
[ -z "$ascii_length" ] && \
ascii_length="$(awk 'length>max{max=length}END{print max}' <<< "$ascii_strip")"
padding="\033[$((ascii_length + gap))C"
printf "%b%s" "$print"