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

ponysay leaves terminal bold after running help command #241

Open
CrazyPython opened this issue Aug 11, 2016 · 6 comments · May be fixed by #257
Open

ponysay leaves terminal bold after running help command #241

CrazyPython opened this issue Aug 11, 2016 · 6 comments · May be fixed by #257

Comments

@CrazyPython
Copy link

CrazyPython commented Aug 11, 2016

Platform: OSX

Ponysay leaves the terminal with bold. I think it's missing a control character. (The text after running ponysay is all in bold)

@JotaRandom
Copy link
Collaborator

I dont have an OSX to test but... I know that in TTY in linux the bold text is also leaved with a different colour.

Do you know what is the "control code" used in OSX to return the bold color to the default?

@CrazyPython
Copy link
Author

@jristz same control code as other POSIX terminals - I've dealt with this before, a few google searches should come up with the reset escape

@JotaRandom
Copy link
Collaborator

I'm testing here in a linux tty and in a unix terminal but no one left the the terminal bold when I use help.

In theory the standard control code showl work but I dont get the problem.

Do you mentioned that his happend on OSX, right? so you you can share some screenshoot or the control code used in the OSX terminal to clean the blodness (just to test that here you know, testing to reach out of the issue)

@hashhar
Copy link

hashhar commented Apr 8, 2017

Does OSX have a tput command? If yes you can use something like tput sgr0 for resetting, tput bold for bold.

cb="$(tput bold)"
cc="$(tput sgr0)"

# Then use them
echo "${cb}BOLD${cc} and normal."

ngyikp added a commit to ngyikp/ponysay that referenced this issue Apr 8, 2017
ngyikp added a commit to ngyikp/ponysay that referenced this issue Apr 8, 2017
@ngyikp
Copy link
Contributor

ngyikp commented Apr 8, 2017

Yeah, tput sgr0 works on Mac 👍
screen shot 2017-04-08 at 6 14 30 pm

At

print('\033[1mUSAGE:\033[21m' if use_colours else 'USAGE:', end='')
, we use code 21 to reset the bold style.

Looking at the node.js world, they use 22 instead, saying "21 isn't widely supported and 22 does the same thing"
https://github.com/chalk/ansi-styles/blob/b559ed61bd09d21cda8fced733c39e4f83fb06bc/index.js#L23

I confirm that changing it to 22 fixes the bug:
master...ngyikp:fix-bold

screen shot 2017-04-08 at 6 44 46 pm

@JotaRandom
Copy link
Collaborator

JotaRandom commented Jun 3, 2017

I tested it and I dont find problem...

so I docided make the pull request as #257

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

Successfully merging a pull request may close this issue.

4 participants