mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-12-14 12:37:16 +00:00
Fix bug with ascii size, the pure bash solution counted the file a little weirdly causing issues for some ascii art
This commit is contained in:
@@ -3,7 +3,7 @@ ${c1} ,.=:!!t3Z3z.,
|
|||||||
:tt:::tt333EE3
|
:tt:::tt333EE3
|
||||||
${c1} Et:::ztt33EEEL${c2} @Ee., ..,
|
${c1} Et:::ztt33EEEL${c2} @Ee., ..,
|
||||||
${c1} ;tt:::tt333EE7${c2} ;EEEEEEttttt33#
|
${c1} ;tt:::tt333EE7${c2} ;EEEEEEttttt33#
|
||||||
${c1} :Et:::zt333EEQ.${c2} \$EEEEEttttt33QL
|
${c1} :Et:::zt333EEQ.${c2} $EEEEEttttt33QL
|
||||||
${c1} it::::tt333EEF${c2} @EEEEEEttttt33F
|
${c1} it::::tt333EEF${c2} @EEEEEEttttt33F
|
||||||
${c1} ;3=*^\`\`\`\"*4EEV${c2} :EEEEEEttttt33@.
|
${c1} ;3=*^\`\`\`\"*4EEV${c2} :EEEEEEttttt33@.
|
||||||
${c3} ,.=::::!t=., ${c1}\`${c2} @EEEEEEtttz33QF
|
${c3} ,.=::::!t=., ${c1}\`${c2} @EEEEEEtttz33QF
|
||||||
|
|||||||
13
neofetch
13
neofetch
@@ -2204,16 +2204,13 @@ getascii () {
|
|||||||
# Turn the file into a variable and strip escape codes.
|
# Turn the file into a variable and strip escape codes.
|
||||||
ascii_strip=$(<"$ascii")
|
ascii_strip=$(<"$ascii")
|
||||||
ascii_strip=${ascii_strip//\$\{??\}}
|
ascii_strip=${ascii_strip//\$\{??\}}
|
||||||
ascii_strip=${ascii_strip//\\\\/ }
|
ascii_strip=${ascii_strip//'\\'}
|
||||||
ascii_strip=${ascii_strip//\\}
|
ascii_strip=${ascii_strip//'\'}
|
||||||
|
|
||||||
# Get length of longest line
|
# Get length of longest line
|
||||||
# Get lines/columns of the ascii file in pure bash.
|
ascii_size="$(awk 'END {printf NR " "}length>max{max=length}END{printf max}' <<< "$ascii_strip")"
|
||||||
while read -r line 2>/dev/null; do
|
lines=${ascii_size/ *}
|
||||||
[ ${#line} -gt ${ascii_length:-0} ] && ascii_length=${#line}
|
ascii_length=${ascii_size/$lines}
|
||||||
lines=$((lines+=1))
|
|
||||||
done <<< "$ascii_strip"
|
|
||||||
lines=$((lines+=1))
|
|
||||||
|
|
||||||
padding="\033[$((ascii_length + gap))C"
|
padding="\033[$((ascii_length + gap))C"
|
||||||
printf "%b%s" "$print"
|
printf "%b%s" "$print"
|
||||||
|
|||||||
Reference in New Issue
Block a user