From 374b1144dec039d61e0523e45d8aab37b6422b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20St=C3=BCrtz?= Date: Mon, 22 Aug 2016 17:27:58 +0200 Subject: [PATCH] Dont't guess the max width, get it from the terminal --- src/cmds/restic/global.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cmds/restic/global.go b/src/cmds/restic/global.go index 898537c31..c547b94ef 100644 --- a/src/cmds/restic/global.go +++ b/src/cmds/restic/global.go @@ -88,8 +88,11 @@ var parser = flags.NewParser(&globalOpts, flags.HelpFlag|flags.PassDoubleDash) // current windows cmd shell. func ClearLine() string { if runtime.GOOS == "windows" { - // Ugly Workaround, write 79 Whitespaces and return - return " \r" + w, _, err := terminal.GetSize(int(os.Stdout.Fd())) + if err == nil { + return strings.Repeat(" ", w-1) + "\r" + } + return "" } return "\x1b[2K" }