Using regex I was able to strip color codes from ascii art line length calculations.

This commit is contained in:
Syphist 2020-08-25 00:00:26 -05:00
parent bfbefc7f6b
commit 0e7799ff7e

View file

@ -3878,6 +3878,8 @@ print_ascii() {
while IFS=$'\n' read -r line; do
line=${line//\\\\/\\}
line=${line//█/ }
# Use Regex through sed to remove color and formatting codes
line=$(echo "$line" | sed 's/\x1B\[[0-9;]*[JKmsu]//g')
((++lines,${#line}>ascii_len)) && ascii_len="${#line}"
done <<< "${ascii_data//\$\{??\}}"