ctongfei / progressbar

Terminal-based progress bar for Java / JVM
http://tongfei.me/progressbar/
MIT License
1.07k stars 102 forks source link

setMaxRenderedLength behaves starangly #129

Closed MagnusErikssonAB closed 2 years ago

MagnusErikssonAB commented 2 years ago

How exactly is the setMaxRenderedLength method intended to work? What is the unit specified?

I have tried various values and with 75 it is just a few characters wide, with 200 it fills half the screen?!?

The length of the bar also seems to change depending on the length of the task name specified (seem like the longer the task name the shorter the bas becomes)....

ctongfei commented 2 years ago

The length does not refer to the number of the bar characters: it refers to the whole output sequence including the task name, estimated time left, etc. In the case that the terminal is unable to get its actual width (normally it should, but under some specific environments it breaks), you can set, e.g., setMaxRenderedLength(80).

MagnusErikssonAB commented 2 years ago

So the intended "scale" of this is "terminaL characters" (setMaxRenderedLength(80) would be for a typical 80 character wide terminal window).... Would be a great addition to the documentation as this is as far as I have seen not mentioned.