From b13da1d9990a9e54326b25cc8828a82a97493197 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 21 Oct 2016 18:02:04 +1100 Subject: [PATCH] Fix C locale padding issues --- neofetch | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/neofetch b/neofetch index e6151acc..1a0df36d 100755 --- a/neofetch +++ b/neofetch @@ -2091,19 +2091,16 @@ getascii() { 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. - ascii_length=0 lines=1 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))" 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" printf "%b%s" "$print" export LC_ALL=C @@ -2595,10 +2592,15 @@ colors() { ascii_distro="mint" ;; - "LMDE"* | "Chapeau"* | "Bitrig"* | "Android"*) + "LMDE"* | "Chapeau"* | "Bitrig"*) setcolors 2 7 ;; + "Android"*) + setcolors 2 7 + ascii_length_force="19" + ;; + "NetBSD"* | "Parabola"* | "Tails"* | "BLAG"*) setcolors 5 7 ;;