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

Make screen clearing somewhat more portable #13

merged 1 commit into from Aug 2, 2015


None yet
2 participants

jmaslak commented Aug 2, 2015

This may not merge perfectly with some of my other pull requests I've put in today - but it should be easy to resolve any conflicts. If you do like this change, and you like another of my change that conflicts, feel free to make me do a new pull request after you merge the other changes that you like.

Printing ANSI escape sequences to clear the screen breaks several things - Strawberry Perl on Win32, non-standard terminals, dumb terminals, and pipes/redirection of the output. I made the clear screen call a function - _cls() - and use Term::Cap (a core module) to get the clear code. If the program is not connected to a terminal (redirected output, for instance), if the terminal isn't known to Term::Cap, or if the terminal is particularly dumb (TERM=dumb), two newlines are printed instead.

I do cache the clear screen code, which probably isn't necessary, but it's a little nicer as far as performance.

This is the last pull request I'm submitting based on the things I saw in the module that I thought I could help with - feel free to give me feedback if you like these ideas but would like to do them a different way, I definitely want this work to fit into your desires for the module.

gugod added a commit that referenced this pull request Aug 2, 2015

Merge pull request #13 from jmaslak/clear_screen
Make screen clearing somewhat more portable

@gugod gugod merged commit 106d772 into gugod:master Aug 2, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment