progressbar icon indicating copy to clipboard operation
progressbar copied to clipboard

Progress bar reset does not do anything

Open Bricktheworld opened this issue 3 years ago • 3 comments

Hello, I'm not sure if I am doing something wrong however I need the progress bar to be able to dip to a lower percentage when necessary. I am calling "stepTo", however, this does not move the progress bar down if a lower percentage is provided. If I try to call "reset", the bar simply ignores that call and continues on. Is this behavior intended? If so is there a way a change can either be implemented or I can modify the library? I am using Arch Linux with alacrity in the zsh shell.

Bricktheworld avatar Feb 03 '22 09:02 Bricktheworld

Actually, I'm sorry, this is my mistake, using the ProgressBarBuilder to continuously update has fixed the issue.

Bricktheworld avatar Feb 03 '22 16:02 Bricktheworld

Hello @Bricktheworld , this does seem like a bug to me. Can you paste your minimized snippet here?

ctongfei avatar Feb 03 '22 19:02 ctongfei

Hey @ctongfei, sorry for the late response! Here is a simple example that should show how it can be reproduced, please let me know if you are able to replicate and if you need anything else.

int someProgress = 0;
try (var pb = new ProgressBar("Some progress", 100)) {
     while(true) {
          Thread.sleep(500);
          if (someProgress >= 100) {
                  pb.reset();
                  someProgress = 0;
                  continue;
          }
          someProgress += 10;
          pb.stepTo(someProgress);
     }
}

Bricktheworld avatar Feb 08 '22 02:02 Bricktheworld

Hi @Bricktheworld sorry for the late response. This is a bug due to a recent optimization that only refreshes the progress bar if it went forward. It did not account for the condition where it stepped backward when calling stepTo. This will be fixed in the next version. Thanks!

ctongfei avatar Sep 10 '22 04:09 ctongfei