-
Notifications
You must be signed in to change notification settings - Fork 91
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
add parameter for fractional bar length #285
base: master
Are you sure you want to change the base?
Conversation
for tests, add a few tests with the new feature but don't change old ones. That way we can check that the change is not breaking. All old tests should still pass (including the deprecated ones, which is not the case at the moment) |
49caa8b
to
237e252
Compare
I've added tests. However, the performance test in full_width = trunc(Int, (displaysize(output)[2]*width_fraction)) It's not consistent, as it sometimes (mostly) fails on my machine. I ran the performance test @test @elapsed(prog_perf(10^7)) < 9*@elapsed(noprog_perf(10^7)) I think the 9 is a bit arbitrary and that the potential slowdown of the truncation is not bad enough. If not, I do not have any other suggestions to improve the code. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #285 +/- ##
=======================================
Coverage 96.81% 96.81%
=======================================
Files 1 1
Lines 533 534 +1
=======================================
+ Hits 516 517 +1
Misses 17 17 ☔ View full report in Codecov by Sentry. |
do you have a reproducible example of your original problem (the progressbar overflowing)? edit: nvm I could reproduce it with |
I find that the progress bar usually overflows when the ETA quickly converges from a large to a small value. Because of this, I want to make the bar shorter. However, since the TTY width is not immediately obvious to me, I would rather like to scale the length of the bar by some fraction. This PR adds this feature.
Summary of changes:
barlen_fraction
to theProgress
-struct, which can take on any float. This means that the bar can be scaled negatively and larger than 1.I might have added too much to the testing, and the argument might be too verbose.