-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Strip color codes from ascii art line length calculations #1543
base: master
Are you sure you want to change the base?
Conversation
I have made several more attempts to work around SC2001, but have had no success. I am wondering if it is too complex to do it with the search and replace in bash and may need to be done with sed. I will probably make further attempts at this, if anyone else has any ideas feel free to let me know too. |
I have figured out the solution and have updated my code accordingly and have cleaned it up. I have tested both with the pasted character in the ascii file and the escape code and both work. This is also much faster than my initial sed implementation. I have updated the OP to reflect these changes as well as clarify a few things. |
…nstances and does not hinder performance where it doesn't work
…master Merge all changes to master to this fork.
Merge changes from main repo to this fork.
Merge upstream changes.
Merge upstream changes
+1 I agree, it's much needed this. |
Just tested this with colored ascii generated with lolcat and works great. |
…scii art line length calculations Upstream PR: dylanaraps/neofetch#1543 Thanks to @Syphist Co-authored-by: Syphist <[email protected]>
Thank you for your contribution! This PR is merged into hyfetch since this repo (dylanaraps/neofetch) seems no longer maintained. HyFetch is a fork of neofetch with LGBTQ pride flags, but the repo also maintains an updated version of the original neofetch, addressing many pull requests that are not merged in the original repo. Read the "Running Updated Original Neofetch" section for more info! |
Proposed by hykilpikonna. Fixes a bug that evals stuff that follows $ characters. Co-authored-by: Hykilpikonna <[email protected]>
I have committed your fix. Thanks for finding a solution and testing further. |
Okay I found another bug lol - while IFS=$'\n' read -r line; do
+ while IFS=$'\n' read line; do The width is incorrectly calculated for ascii distros with backslashes in them (e.g. Bedrock) because the backslashes were not treated as escape characters in So, if Before Fix: After Fix: |
Thanks @hykilpikonna I fixed the issue on my fork as well just in case this ever gets merged upstream to neofetch or if someone bothers to use my fork. |
Description
This removes color and formatting codes from the line length calculation to allow for more control over custom ascii art. This would also fix issues I found when attempting to use the patch in #1220.
Features
Allows for support for finer control of ascii art using escapes such as "[38;5;39m" for defining coloring and formatting in the terminal.
Issues
None that I have found
TODO
Nothing
Fixed Issues
This so far only works if you directly paste the character for \033 or "�" into the file. I was unable to get it to work for both.