dylanaraps / neofetch

🖼️ A command-line system information tool written in bash 3.2+
MIT License
21.57k stars 1.74k forks source link

Add ANSI 8-bit Support #2376

Open seujorgenochurras opened 10 months ago

seujorgenochurras commented 10 months ago

Description

I'm doing an ascii art project, and I noticed that it would be awesome to have a profile picture in Neofetch, but there's a problem: for some reason, Neofetch treats 8-bit colors as actual characters.
This means that if I have, for instance, ^[[38;231;0;255m hi mom it will trhow the neofetch system information about 12 characters to the right, instead of the 1 expected.

I know this is hard af to explain, and my poorly written text doesn't help, so I have an image to give as an example: image

As you can see the information went far away, this is because it sees the ansi color as a char. For example, in the first line, we have ╏0╏

I have no idea how hard it is to fix this issue, but it shouldn't be that hard, as I was kind of able to fix it with simple tweaks. image

Now, you can argue that if I'm using chars to make colored art, why don't I use images in the first place?
And if you say that, I just gotta tell you to stop, this way of thinking hurts my feelings and f u

seujorgenochurras commented 10 months ago

I guess this isn't needed, but if you guys need the ascii art to see the bug this one might be useful:

profile.ascii.txt

I also have a smaller version of the same ascii art smallest-profile.ascii.txt

seujorgenochurras commented 10 months ago

I've fixed it by changing a line of the print_ascii() function from line=${line//█/ } to line=$(echo -e "$line" | sed -E 's/█//g; s/\x1B\[[0-9;]*[a-zA-Z]//g')