From 1890bb8f033a327fbe983b6a293fca8357d75654 Mon Sep 17 00:00:00 2001 From: Azalea Date: Fri, 22 May 2026 08:33:42 +0800 Subject: [PATCH] [F] Fix ascii from file for neofetch (#505) --- crates/hyfetch/build.rs | 1 + neofetch | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/hyfetch/build.rs b/crates/hyfetch/build.rs index 867995cd..5ce00d42 100644 --- a/crates/hyfetch/build.rs +++ b/crates/hyfetch/build.rs @@ -65,6 +65,7 @@ fn main() -> Result<()> { &dir.join("neofetch"), &dir.join("../../neofetch"), ]).context("couldn't find neofetch")?; + println!("cargo:rerun-if-changed={}", neofetch_src.display()); fs::copy(&neofetch_src, o.join("neofetch"))?; preset_codegen(&o.join("hyfetch/data/presets.json"), &o.join("presets.rs"))?; diff --git a/neofetch b/neofetch index dc8d458e..408aca8f 100755 --- a/neofetch +++ b/neofetch @@ -5556,8 +5556,11 @@ strip_escape_codes() { } print_ascii() { + local ascii_from_file="off" + if [[ -f "$image_source" && ! "$image_source" =~ (png|jpg|jpeg|jpe|svg|gif) ]]; then ascii_data="$(< "$image_source")" + ascii_from_file="on" elif [[ "$image_source" == "ascii" || $image_source == auto ]]; then : else @@ -5586,7 +5589,7 @@ print_ascii() { fi # Fallback if file not found. - ((lines==1)) && { + [[ "$ascii_from_file" != "on" ]] && ((lines==1)) && { lines= ascii_len= image_source=auto