console-rs / indicatif

A command line progress reporting library for Rust
MIT License
4.46k stars 243 forks source link

fix: inc after work #522

Closed tatref closed 1 year ago

tatref commented 1 year ago

See #521

tatref commented 1 year ago

I guess the effect of set_message is only seen after calling inc? So this should probably be just after inc?

I missed it in the finebars example:

thread::sleep(wait);
pb.inc(1);
pb.set_message(format!("{:3}%", 100 * i / 512));
djc commented 1 year ago

I guess the effect of set_message is only seen after calling inc? So this should probably be just after inc?

Hmm, I suppose both set_message() and inc() will end up calling ProgressState::update_estimate_and_draw() so it probably doesn't really matter which one goes first.