mirror of https://github.com/sbt/sbt.git
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.
This commit is contained in:
parent
e1103d1557
commit
a4e1c5aad5
|
|
@ -665,20 +665,18 @@ private[sbt] object ProgressState {
|
||||||
|
|
||||||
val currentLength = info.foldLeft(0)(_ + terminal.lineCount(_))
|
val currentLength = info.foldLeft(0)(_ + terminal.lineCount(_))
|
||||||
val previousLines = state.progressLines.getAndSet(info)
|
val previousLines = state.progressLines.getAndSet(info)
|
||||||
if (previousLines != info) {
|
val prevLength = previousLines.foldLeft(0)(_ + terminal.lineCount(_))
|
||||||
val prevLength = previousLines.foldLeft(0)(_ + terminal.lineCount(_))
|
val lastLine = terminal.prompt match {
|
||||||
val lastLine = terminal.prompt match {
|
case Prompt.Running | Prompt.Batch => terminal.getLastLine.getOrElse("")
|
||||||
case Prompt.Running | Prompt.Batch => terminal.getLastLine.getOrElse("")
|
case a => a.render()
|
||||||
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 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) {
|
} else if (state.progressLines.get.nonEmpty) {
|
||||||
state.progressLines.set(Nil)
|
state.progressLines.set(Nil)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue