From 5444ecdf6db3f13616ca65aceff1e4ea58d115a0 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 28 Aug 2016 10:49:35 +1000 Subject: [PATCH] Fix padding on Android --- neofetch | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index 6b5162a4..0cc63954 100755 --- a/neofetch +++ b/neofetch @@ -1968,14 +1968,13 @@ getascii() { ascii_strip="${ascii_strip//'\\'/ }" ascii_strip="${ascii_strip//'\'}" - # Get lines/columns of the ascii file in pure bash. + # Get length of the ascii file. ascii_length=0 - lines=1 - while IFS='\n' read -r line 2>/dev/null; do - [ ${#line} -gt "$ascii_length" ] && ascii_length=${#line} - lines=$((lines+=1)) + while IFS='' read -r line 2>/dev/null; do + [ "${#line}" -gt "$ascii_length" ] && ascii_length="${#line}" done <<< "$ascii_strip" + lines="$(printf "%s\n" "$ascii_strip" | wc -l)" padding="\033[$((ascii_length + gap))C" printf "%b%s" "$print" export LC_ALL=C