From d03892671496c141f440726f990e692667059a45 Mon Sep 17 00:00:00 2001 From: Tal Pressman Date: Wed, 10 May 2023 09:31:20 +0900 Subject: [PATCH] trim snapshot progress output --- src/progress.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/progress.rs b/src/progress.rs index 8566d06f0..125893232 100644 --- a/src/progress.rs +++ b/src/progress.rs @@ -196,10 +196,15 @@ pub fn snapshot_progress(ui: &mut Ui) -> Option { .output_guard(format!("\r{}", Clear(ClearType::CurrentLine))), ); } + + let line_width = state.ui.term_width().map(usize::from).unwrap_or(80); + let path_width = line_width.saturating_sub(13); // Account for "Snapshotting " + _ = write!( state.ui, - "\r{}Snapshotting {}", + "\r{}Snapshotting {:.*}", Clear(ClearType::CurrentLine), + path_width, path.to_fs_path(Path::new("")).display() ); _ = state.ui.flush();