Fix bug with block chars

This commit is contained in:
Dylan Araps 2016-10-21 17:19:03 +11:00
parent e5359dc314
commit 7bdf5f1168
1 changed files with 5 additions and 5 deletions

View File

@ -2091,6 +2091,11 @@ getascii() {
ascii_strip="${ascii_strip//'\\'/ }" ascii_strip="${ascii_strip//'\\'/ }"
ascii_strip="${ascii_strip//'\'}" ascii_strip="${ascii_strip//'\'}"
# Workaround for calculating length of block chars
# when locale is set to 'C'
block_char="█"
[ "${#block_char}" == 3 ] && ascii_strip="${ascii_strip//${block_char}/ }"
# Get lines/columns of the ascii file. # Get lines/columns of the ascii file.
ascii_length=0 ascii_length=0
lines=1 lines=1
@ -2099,11 +2104,6 @@ getascii() {
lines="$((lines+=1))" lines="$((lines+=1))"
done <<< "$ascii_strip" done <<< "$ascii_strip"
# Workaround for calculating length of block chars
# when locale is set to 'C'
block_char="█"
[ "${#block_char}" == 3 ] && ascii_length="$((ascii_length / 3 + 2))"
padding="\033[$((ascii_length + gap))C" padding="\033[$((ascii_length + gap))C"
printf "%b%s" "$print" printf "%b%s" "$print"
export LC_ALL=C export LC_ALL=C