-
Notifications
You must be signed in to change notification settings - Fork 245
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
ProgressSpinners with tick strings skips the last frame, panics on one frame #477
Comments
For the first issue, could I see the full context? The second issue looks like an easy fix. Thanks for the report! |
The first issue can be replicated with this: use indicatif::{ProgressBar, ProgressStyle};
use std::time::Duration;
fn main() {
let spinner = ProgressBar::new_spinner();
spinner.enable_steady_tick(Duration::from_millis(1000));
spinner.set_style(
ProgressStyle::with_template("{msg}{spinner}")
.unwrap()
.tick_strings(&["1", "2", "3", "4"]),
);
std::thread::sleep_ms(10_000);
spinner.finish_and_clear();
} |
The way With that in mind, this should actually be rejected by spinner.set_style(ProgressStyle::with_template("{msg}{spinner}")?.tick_strings(&["1"])); @djc what do you think? |
In that case, would it be better to provide a separate function that will set this "finished" state, instead of taking the last of the tick chars/strings as the "finished" state? Maybe even as an argument to the |
Maybe. I do agree the current API is a little confusing.
That's the hard part :/ |
I'll leave the API design to people who are actually good at that (i.e. not me), but maybe |
I agree that the API is unclear. We could potentially add a new |
Yes please, that seems like a neat API. We ran into this (last tick string not printed) as well and set out to PR a documentation update before finding this issue. |
With this spinner configuration we see 1, 2, then 3. 4 is never printed.
With this configuration we get a panic:
The text was updated successfully, but these errors were encountered: