From b7c990871ffba76981ef31ecd075e9176453814b Mon Sep 17 00:00:00 2001 From: greatroar <61184462+greatroar@users.noreply.github.com> Date: Tue, 31 May 2022 18:41:46 +0200 Subject: [PATCH] cmd/restic: Remove trailing "..." from progress messages These were added after message since the last refactor of the progress printing code. Also skips an allocation in the common case. --- cmd/restic/progress.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/restic/progress.go b/cmd/restic/progress.go index 5a77bc6ee..4f33e2072 100644 --- a/cmd/restic/progress.go +++ b/cmd/restic/progress.go @@ -58,7 +58,10 @@ func printProgress(status string, canUpdateStatus bool) { if w < 3 { status = termstatus.Truncate(status, w) } else { - status = termstatus.Truncate(status, w-3) + "..." + trunc := termstatus.Truncate(status, w-3) + if len(trunc) < len(status) { + status = trunc + "..." + } } }