henrik / progress_bar

Command-line progress bars and spinners for Elixir.
MIT License
333 stars 20 forks source link

Lots of line-breaks when terminal window is too narrow #9

Closed martinsvalin closed 9 years ago

martinsvalin commented 9 years ago

Progress bars are pretty wide. When the terminal window is too narrow for them, they print each update on its own line. I don't know the exact break point, but 80 columns is too narrow and will show this bug.

$ mix run examples/01-default.exs

Default bar:
|=
|==
|===
|====
|=====
etc…
henrik commented 9 years ago

Good point. I have considered auto-detecting terminal width at some point.

Seems ruby-progressbar has this figured out: https://github.com/jfelchner/ruby-progressbar/wiki/Overriding-the-Length

henrik commented 9 years ago

Seems tput cols in a terminal will get us the number of columns: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window

henrik commented 9 years ago

Considering this done. @martinsvalin, if you have the inclination, try it out and let me know how it works for you!