Merge pull request #595 from dylanaraps/ascii_fix

Ascii: Fix hang caused by missing OS ascii art.
This commit is contained in:
Dylan Araps 2017-01-05 01:55:30 +11:00 committed by GitHub
commit e77c7eada6

View file

@ -1906,7 +1906,7 @@ get_image_backend() {
get_ascii() { get_ascii() {
if [[ ! -f "$ascii" || "$ascii" == "distro" ]]; then if [[ ! -f "$ascii" || "$ascii" == "distro" ]]; then
# Error message. # Fallback to distro ascii mode if custom ascii isn't found.
[[ "$ascii" != "distro" && ! -f "$ascii" ]] && \ [[ "$ascii" != "distro" && ! -f "$ascii" ]] && \
err "Ascii: Ascii file not found, using distro ascii." err "Ascii: Ascii file not found, using distro ascii."
@ -1922,12 +1922,13 @@ get_ascii() {
else else
get_script_dir 2>/dev/null get_script_dir 2>/dev/null
ascii_dir="${script_dir}/ascii/distro" ascii_dir="${script_dir}/ascii/distro"
[[ -d "$ascii_dir" ]] || \
{ to_off "Ascii: Ascii file not found, falling back to text mode."; return; }
fi fi
ascii="${ascii_dir}/${ascii_file}" ascii="${ascii_dir}/${ascii_file}"
# Fallback to no ascii mode if distro ascii isn't found.
[[ ! -f "$ascii" ]] && \
{ to_off "Ascii: Failed to find distro ascii, falling back to no ascii mode."; return; }
fi fi
# Set locale to get correct padding. # Set locale to get correct padding.
@ -2283,8 +2284,9 @@ to_ascii() {
to_off() { to_off() {
# This function makes neofetch fallback to off mode. # This function makes neofetch fallback to off mode.
text_padding="0"
image_backend="off" image_backend="off"
text_padding=
zws=
err "$1" err "$1"
} }
@ -2419,7 +2421,7 @@ prin() {
string="${subtitle_color}${bold}${string}" string="${subtitle_color}${bold}${string}"
# Print the info. # Print the info.
printf "%b\n" "\033[${text_padding}C${zws}${string}${reset} " printf "%b\n" "${text_padding:+\033[${text_padding}C}${zws}${string}${reset} "
# Calculate info height. # Calculate info height.
info_height="$((info_height+=1))" info_height="$((info_height+=1))"