From fb2d4fc42100c07b088f182db12e56e79dea128f Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sun, 29 Oct 2023 20:57:03 -0700 Subject: [PATCH] Set style before message (#229) Prevents flickering in the resolver case. --- crates/puffin-cli/src/commands/reporters.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/puffin-cli/src/commands/reporters.rs b/crates/puffin-cli/src/commands/reporters.rs index 56dd535c2..a8ac66a77 100644 --- a/crates/puffin-cli/src/commands/reporters.rs +++ b/crates/puffin-cli/src/commands/reporters.rs @@ -14,10 +14,10 @@ pub(crate) struct WheelFinderReporter { impl From for WheelFinderReporter { fn from(printer: Printer) -> Self { let progress = ProgressBar::with_draw_target(None, printer.target()); - progress.set_message("Resolving dependencies..."); progress.set_style( ProgressStyle::with_template("{bar:20} [{pos}/{len}] {wide_msg:.dim}").unwrap(), ); + progress.set_message("Resolving dependencies..."); Self { progress } } } @@ -50,10 +50,10 @@ pub(crate) struct UnzipReporter { impl From for UnzipReporter { fn from(printer: Printer) -> Self { let progress = ProgressBar::with_draw_target(None, printer.target()); - progress.set_message("Unzipping wheels..."); progress.set_style( ProgressStyle::with_template("{bar:20} [{pos}/{len}] {wide_msg:.dim}").unwrap(), ); + progress.set_message("Unzipping wheels..."); Self { progress } } } @@ -85,10 +85,10 @@ pub(crate) struct DownloadReporter { impl From for DownloadReporter { fn from(printer: Printer) -> Self { let progress = ProgressBar::with_draw_target(None, printer.target()); - progress.set_message("Downloading wheels..."); progress.set_style( ProgressStyle::with_template("{bar:20} [{pos}/{len}] {wide_msg:.dim}").unwrap(), ); + progress.set_message("Downloading wheels..."); Self { progress } } } @@ -120,10 +120,10 @@ pub(crate) struct InstallReporter { impl From for InstallReporter { fn from(printer: Printer) -> Self { let progress = ProgressBar::with_draw_target(None, printer.target()); - progress.set_message("Installing wheels..."); progress.set_style( ProgressStyle::with_template("{bar:20} [{pos}/{len}] {wide_msg:.dim}").unwrap(), ); + progress.set_message("Installing wheels..."); Self { progress } } } @@ -155,13 +155,13 @@ pub(crate) struct ResolverReporter { impl From for ResolverReporter { fn from(printer: Printer) -> Self { let progress = ProgressBar::with_draw_target(None, printer.target()); - progress.set_message("Resolving dependencies..."); progress.enable_steady_tick(Duration::from_millis(200)); progress.set_style( ProgressStyle::with_template("{spinner:.white} {wide_msg:.dim}") .unwrap() .tick_strings(&["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]), ); + progress.set_message("Resolving dependencies..."); Self { progress } } }