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

Don't fail when terminal says 0 columns #167

Merged
merged 1 commit into from
Nov 8, 2019
Merged

Conversation

libnoon
Copy link
Contributor

@libnoon libnoon commented Oct 21, 2019

Some terminals say their width is 0. In that case, use some default
width rather than displaying ugly warnings.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942759

@liske
Copy link
Owner

liske commented Nov 3, 2019

Thanks for the PR, I would like to merge it but:

  • I would not like to switch to Term::ProgressBar since it adds additional dependencies (and Termin::ProgressBar is not that common)
  • please split the documentation comments into another PR (which I would like to merge)

@libnoon
Copy link
Contributor Author

libnoon commented Nov 6, 2019

Done!
The documentation PR is #169.

sub _get_columns {
my $default_columns = 80; # Sane default
if (-t *STDOUT) {
my ($columns) = GetTerminalSize(\*STDOUT);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pass the filehandle twice due to Debian Bug#824564 (as already done in wprint).

Some terminals say their width is 0.  In that case, use some default
width rather than displaying ugly warnings.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942759
@libnoon
Copy link
Contributor Author

libnoon commented Nov 7, 2019 via email

@liske liske merged commit c1324e5 into liske:master Nov 8, 2019
@liske
Copy link
Owner

liske commented Nov 8, 2019

Thanks!

@libnoon libnoon deleted the 0-width-term branch November 8, 2019 23:22
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 this pull request may close these issues.

2 participants