From a4e1c5aad5052d777ac76657ff1b0c871921c81f Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Sun, 28 Jun 2020 17:56:35 -0700 Subject: [PATCH] Always print progress lines It seemed like a good idea to avoid printing the progress lines if they were the same as last time. Unfortunately there is a scenario where the user has multiple clients open and while one of the clients is running a command, the user presses enter in the inactive client. When this happens the message that warns that the server is running a different command gets overwritten. Always printing keeps the message visible. --- .../sbt/internal/util/ConsoleAppender.scala | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/ConsoleAppender.scala b/internal/util-logging/src/main/scala/sbt/internal/util/ConsoleAppender.scala index fb7d6be16..36b64ee8c 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/ConsoleAppender.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/ConsoleAppender.scala @@ -665,20 +665,18 @@ private[sbt] object ProgressState { val currentLength = info.foldLeft(0)(_ + terminal.lineCount(_)) val previousLines = state.progressLines.getAndSet(info) - if (previousLines != info) { - val prevLength = previousLines.foldLeft(0)(_ + terminal.lineCount(_)) - val lastLine = terminal.prompt match { - case Prompt.Running | Prompt.Batch => terminal.getLastLine.getOrElse("") - case a => a.render() - } - val prevSize = prevLength + state.padding.get - - val newPadding = math.max(0, prevSize - currentLength) - state.padding.set(newPadding) - state.printPrompt(terminal, ps) - ps.print(state.printProgress(terminal, lastLine)) - ps.flush() + val prevLength = previousLines.foldLeft(0)(_ + terminal.lineCount(_)) + val lastLine = terminal.prompt match { + case Prompt.Running | Prompt.Batch => terminal.getLastLine.getOrElse("") + case a => a.render() } + val prevSize = prevLength + state.padding.get + + val newPadding = math.max(0, prevSize - currentLength) + state.padding.set(newPadding) + state.printPrompt(terminal, ps) + ps.print(state.printProgress(terminal, lastLine)) + ps.flush() } } else if (state.progressLines.get.nonEmpty) { state.progressLines.set(Nil)