-
Notifications
You must be signed in to change notification settings - Fork 277
Open
Description
The documentation for set_move_cursor says:
This can reduce flickering, but do not enable it if you intend to change the number of progress bars.
It does not say anything about other restrictions, only not to use it when changing the number of bars. Consider the following code:
use indicatif::{MultiProgress, ProgressBar};
use std::thread::sleep;
fn main() {
const SEC: std::time::Duration = std::time::Duration::from_secs(1);
let pb = ProgressBar::new_spinner();
let mp = MultiProgress::new();
mp.add(pb.clone());
mp.set_move_cursor(true);
pb.set_message("This is quite a long message");
sleep(SEC);
pb.tick();
sleep(SEC);
mp.println("foo");
sleep(SEC);
pb.tick();
sleep(SEC);
}This code does not, at any point, change the number of progress bars—it creates exactly one progress bar that lasts for the program’s whole lifetime, and adds it to the MultiProgress as early as it possibly can, before setting the message or doing anything else with either object. However, the output of this program looks like this, once the println runs:
foohis is quite a long message
⠉ This is quite a long message
I’m using urxvt 9.31.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels