diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-12-09 17:18:35 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-12-09 17:23:55 +0100 |
commit | e91869e46fc39e1a6e91dce5c603911fcaad10f5 (patch) | |
tree | aceb1d697384347d6991b4d70f50a18a21f6ad15 /src/main.rs | |
parent | 2205057859f8321496a8a800c242c6cd82fef168 (diff) |
Fix weird rendering bug of progress bars
Apparently, this fixes the rendering bug we had with indicatif.
The issue was, that we called `indicatif::ProgressBar::set_message()`
before the bar was added to the `indicatif::MultiProgress` object.
This caused the bar to be rendered, and as soon we added it to the
MultiProgress object and re-called set_message(), it was rendered again.
This is of course a bug / inconveniance in indicatif.
Either way, the issue was solved by not calling `set_message()` in our
`ProgressBars` helper object, but only return a preconfigured bar
object.
Because not calling the set_message() function yields the whole bunch of
helper functions as unnecessary, these were removed and the interface
was boiled down to `pub fn ProgressBars::bar(&self) ->
indicatif::ProgressBar` which in turn results in a few modifications all
over the place.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 750e3d9..e00014b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,7 +87,7 @@ async fn main() -> Result<()> { let progressbars = ProgressBars::setup(config.progress_format().clone(), config.spinner_format().clone(), hide_bars); let load_repo = || -> Result<Repository> { - let bar = progressbars.repo_loading(); + let bar = progressbars.bar(); bar.set_length(max_packages); let repo = Repository::load(&repo_path, &bar)?; bar.finish_with_message("Repository loading finished"); @@ -106,14 +106,14 @@ async fn main() -> Result<()> { }, Some(("what-depends", matches)) => { let repo = load_repo()?; - let bar = progressbars.what_depends(); + let bar = progressbars.bar(); bar.set_length(max_packages); crate::commands::what_depends(matches, &config, repo).await? }, Some(("dependencies-of", matches)) => { let repo = load_repo()?; - let bar = progressbars.what_depends(); + let bar = progressbars.bar(); bar.set_length(max_packages); crate::commands::dependencies_of(matches, &config, repo).await? }, |