Fix C locale padding issues
This commit is contained in:
parent
7bdf5f1168
commit
b13da1d999
18
neofetch
18
neofetch
|
@ -2091,19 +2091,16 @@ 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
|
|
||||||
lines=1
|
lines=1
|
||||||
while IFS='\n' read -r line 2>/dev/null; do
|
while IFS='\n' read -r line 2>/dev/null; do
|
||||||
[ "${#line}" -gt "$ascii_length" ] && ascii_length="${#line}"
|
[ "${#line}" -gt "${ascii_length:-0}" ] && ascii_length="${#line}"
|
||||||
lines="$((lines+=1))"
|
lines="$((lines+=1))"
|
||||||
done <<< "$ascii_strip"
|
done <<< "$ascii_strip"
|
||||||
|
|
||||||
|
# Overwrite padding if ascii_length_force is set.
|
||||||
|
[ "$ascii_length_force" ] && ascii_length="$ascii_length_force"
|
||||||
|
|
||||||
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
|
||||||
|
@ -2595,10 +2592,15 @@ colors() {
|
||||||
ascii_distro="mint"
|
ascii_distro="mint"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"LMDE"* | "Chapeau"* | "Bitrig"* | "Android"*)
|
"LMDE"* | "Chapeau"* | "Bitrig"*)
|
||||||
setcolors 2 7
|
setcolors 2 7
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
"Android"*)
|
||||||
|
setcolors 2 7
|
||||||
|
ascii_length_force="19"
|
||||||
|
;;
|
||||||
|
|
||||||
"NetBSD"* | "Parabola"* | "Tails"* | "BLAG"*)
|
"NetBSD"* | "Parabola"* | "Tails"* | "BLAG"*)
|
||||||
setcolors 5 7
|
setcolors 5 7
|
||||||
;;
|
;;
|
||||||
|
|
Reference in New Issue