Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANSI art is garbled because of wordwrap. #5

Closed
mainsm opened this issue Apr 25, 2023 · 2 comments · Fixed by #6
Closed

ANSI art is garbled because of wordwrap. #5

mainsm opened this issue Apr 25, 2023 · 2 comments · Fixed by #6

Comments

@mainsm
Copy link

mainsm commented Apr 25, 2023

Wordwrap can cause the ansi art to be badly distorted. This is especially the case in small terminals like Termux.

On reddit, a user named romkatv came up with a solution. https://www.reddit.com/r/zsh/comments/12ueb6b/comment/jhmlgez/?utm_source=share&utm_medium=web2x&context=3

Disable wordwrap before printing the art and then reenable it after.

print -n '\e[?7l' # turn off automatic margins (a.k.a. line wrapping)
iconv -f 437 < $ansi_filename
print -n '\e[?7h' # restore automatic margins

I'd have submitted this as a PR, but I didn't write the original code.

@yuhonas
Copy link
Owner

yuhonas commented Apr 27, 2023

Thanks for posting this! i've put up a fix here #6 with an option to opt out of line wrapping disabling if for some reason you need to, it sounds like a sensible default though just erring on the side of other use cases I may not be aware of

@yuhonas
Copy link
Owner

yuhonas commented Apr 28, 2023

This is now the exception you need to opt in for, I feel small fixed screen sizes are the exception, i've also updated the README accordingly - 405c4c0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants