mirror of https://github.com/sbt/sbt.git
Fix prompt for task progress
This commit is contained in:
parent
f10455fe40
commit
d58b302a97
|
|
@ -216,7 +216,7 @@ val completeProj = (project in file("internal") / "util-complete")
|
|||
exclude[DirectMissingMethodProblem]("sbt.internal.util.complete.History.this"),
|
||||
),
|
||||
)
|
||||
.configure(addSbtIO, addSbtUtilControl)
|
||||
.configure(addSbtIO, addSbtUtilControl, addSbtUtilLogging)
|
||||
|
||||
// A logic with restricted negation as failure for a unique, stable model
|
||||
val logicProj = (project in file("internal") / "util-logic")
|
||||
|
|
|
|||
|
|
@ -64,16 +64,23 @@ abstract class JLine extends LineReader {
|
|||
}
|
||||
|
||||
private[this] def handleMultilinePrompt(prompt: String): String = {
|
||||
val lines = """\r?\n""".r.split(prompt)
|
||||
lines.length match {
|
||||
case 0 | 1 => prompt
|
||||
case _ =>
|
||||
val lines0 = """\r?\n""".r.split(prompt)
|
||||
lines0.length match {
|
||||
case 0 | 1 => handleProgress(prompt)
|
||||
case _ =>
|
||||
val lines = lines0.toList map handleProgress
|
||||
// Workaround for regression jline/jline2#205
|
||||
reader.getOutput.write(lines.init.mkString("\n") + "\n")
|
||||
lines.last
|
||||
}
|
||||
}
|
||||
|
||||
private[this] def handleProgress(prompt: String): String = {
|
||||
import ConsoleAppender._
|
||||
if (showProgress) s"$ScrollUp$DeleteLine" + prompt
|
||||
else prompt
|
||||
}
|
||||
|
||||
private[this] def resume(): Unit = {
|
||||
jline.TerminalFactory.reset
|
||||
JLine.terminal.init
|
||||
|
|
|
|||
|
|
@ -77,8 +77,6 @@ object Aggregation {
|
|||
if (show.taskValues) printSettings(r, show.print)
|
||||
}
|
||||
if (show.success) printSuccess(start, stop, extracted, success, log)
|
||||
// wait for async logger to catch up
|
||||
Thread.sleep(100)
|
||||
}
|
||||
|
||||
def timedRun[T](
|
||||
|
|
@ -131,9 +129,9 @@ object Aggregation {
|
|||
if (get(showSuccess)) {
|
||||
if (get(showTiming)) {
|
||||
val msg = timingString(start, stop, structure.data, currentRef)
|
||||
if (success) log.success(msg + "\n") else log.error(msg + "\n")
|
||||
if (success) log.success(msg) else log.error(msg)
|
||||
} else if (success)
|
||||
log.success("" + "\n")
|
||||
log.success("")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue