From 61231b8e97fd0114df43646b3da387493eb1c8f8 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 29 Sep 2019 20:01:46 +0100 Subject: [PATCH] [uishell] ProgressUI uses only 2 line per file (#221) --- .../net/kemitix/thorp/uishell/ProgressUI.scala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/uishell/src/main/scala/net/kemitix/thorp/uishell/ProgressUI.scala b/uishell/src/main/scala/net/kemitix/thorp/uishell/ProgressUI.scala index 1588ea5..e8de94c 100644 --- a/uishell/src/main/scala/net/kemitix/thorp/uishell/ProgressUI.scala +++ b/uishell/src/main/scala/net/kemitix/thorp/uishell/ProgressUI.scala @@ -18,7 +18,7 @@ object ProgressUI { private val uploads: AtomicReference[Map[RemoteKey, UploadState]] = new AtomicReference[Map[RemoteKey, UploadState]](Map.empty) - private val statusHeight = 3 + private val statusHeight = 2 def requestCycle( localFile: LocalFile, @@ -53,12 +53,14 @@ object ProgressUI { val fileLength = sizeInEnglish(state.fileLength) val line1 = s"${GREEN}Uploading:$RESET ${remoteKey.key}$eraseLineForward" - val line2 = s"$GREEN File:$RESET ($percent%) $transferred of $fileLength" + s"$eraseLineForward" - val line3 = - progressBar(state.transferred, state.fileLength, Terminal.width) + val line2body = s"($percent%) $transferred of $fileLength " + val bar = + progressBar(state.transferred, + state.fileLength, + Terminal.width - line2body.length) + val line2 = s"$GREEN$line2body$RESET$bar$eraseLineForward" Console.putStrLn(line1) *> - Console.putStrLn(line2) *> - Console.putStrLn(line3) + Console.putStrLn(line2) } } *> Console.putStr(resetCursor) }