console-rs / indicatif

A command line progress reporting library for Rust
MIT License
4.23k stars 240 forks source link

Overall bar getting "spammed" in 0.17 instead of updating in place #454

Closed forbjok closed 9 months ago

forbjok commented 1 year ago

After updating indicatif to v0.17, the overall progress bar in my application is seemingly getting "spammed", creating a new line every time the sub-progress bar gets updated.

I believe I've seen this same behavior with 0.16 if both bars were being updated at the same time, but this is not the case either example. The overall bar is only updated after the sub-bar is cleared, before a new sub-bar is created. There is no multithreading going on.

Here's how it looks with 0.17: image

The expected behavior, as it is in 0.16.2: image

The code for the program in these examples is available at: https://github.com/forbjok/hasha

(the 0.17 version is in a separate branch indicatif-0.17 for the time being)

UPDATE: I fixed the issue by using MultiProgress. I'm not sure if this should be necessary (it wasn't before 0.17), since there is no multithreading going on and the bars were not being updated at the same time, but this does fix the issue at least. The only downside of this is that there is a lot more flickering, but after doing some testing it seems like this is mainly an issue when running in ConEmu, and much less noticeable in most other terminal emulators, so not really a big deal.

djc commented 1 year ago

A lot more flickering sounds undesirable... I'm also curious about the setup you had before with multiple co-evolving independent ProgressBars. Would you be able to provide a minimal stand-alone reproduction for both of these?

forbjok commented 1 year ago

Here's a minimal reproduction showing it working with 0.16.2, and the same updated to 0.17 and duplicating lines.

https://github.com/forbjok/indicatif-repro

The first commit is the one working with 0.16, the last commit (current main branch) is updated to 0.17 and generating duplicate lines.

That said, I will probably be sticking to using MultiProgress, as it has the advantage of being able to update both bars simultaneously without causing issues. And as I said, the flickering issue is mainly with ConEmu (which just happens to be the one I mainly use in Windows). In other terminal emulators such as Alacritty, WezTerm, Windows Terminal and surprisingly even the basic CMD console that comes with windows, there isn't really any significant flickering.

chris-laplante commented 1 year ago

@forbjok - sorry, didn't mean to edit your comment. I clicked in the wrong tab in Chrome :(. I've reverted the edit.

chris-laplante commented 1 year ago

That said, I will probably be sticking to using MultiProgress, as it has the advantage of being able to update both bars simultaneously without causing issues. And as I said, the flickering issue is mainly with ConEmu (which just happens to be the one I mainly use in Windows). In other terminal emulators such as Alacritty, WezTerm, Windows Terminal and surprisingly even the basic CMD console that comes with windows, there isn't really any significant flickering.

Hi @forbjok - has MultiProgress entirely resolved your issue then? If so, can we close this?