mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-12-23 20:12:31 +00:00
Swap to a portable way of getting the ascii size'
This commit is contained in:
6
neofetch
6
neofetch
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user