mirror of https://github.com/sbt/sbt.git
Merge pull request #5898 from eatkins/clear-prompt-fix
Clear prompt only if there are no bytes pending
This commit is contained in:
commit
4ffddfe5ea
|
|
@ -72,8 +72,7 @@ private[sbt] final class ProgressState(
|
||||||
if (!lines.endsWith(System.lineSeparator)) {
|
if (!lines.endsWith(System.lineSeparator)) {
|
||||||
val allLines = lines.split(System.lineSeparator)
|
val allLines = lines.split(System.lineSeparator)
|
||||||
allLines.dropRight(1).foreach(appendLine)
|
allLines.dropRight(1).foreach(appendLine)
|
||||||
allLines.lastOption
|
allLines.lastOption.foreach(currentLineBytes.get ++= _.getBytes("UTF-8"))
|
||||||
.foreach(currentLineBytes.get ++= _.getBytes("UTF-8"))
|
|
||||||
} else if (lines.contains(System.lineSeparator)) {
|
} else if (lines.contains(System.lineSeparator)) {
|
||||||
lines.split(System.lineSeparator).foreach(appendLine)
|
lines.split(System.lineSeparator).foreach(appendLine)
|
||||||
}
|
}
|
||||||
|
|
@ -92,11 +91,12 @@ private[sbt] final class ProgressState(
|
||||||
printStream: PrintStream,
|
printStream: PrintStream,
|
||||||
hasProgress: Boolean
|
hasProgress: Boolean
|
||||||
): Unit = {
|
): Unit = {
|
||||||
|
val canClearPrompt = currentLineBytes.get.isEmpty
|
||||||
addBytes(terminal, bytes)
|
addBytes(terminal, bytes)
|
||||||
if (hasProgress) {
|
if (hasProgress) {
|
||||||
val toWrite = new ArrayBuffer[Byte]
|
val toWrite = new ArrayBuffer[Byte]
|
||||||
terminal.prompt match {
|
terminal.prompt match {
|
||||||
case a: Prompt.AskUser if a.render.nonEmpty =>
|
case a: Prompt.AskUser if a.render.nonEmpty && canClearPrompt =>
|
||||||
toWrite ++= (DeleteLine + ClearScreenAfterCursor + CursorLeft1000).getBytes("UTF-8")
|
toWrite ++= (DeleteLine + ClearScreenAfterCursor + CursorLeft1000).getBytes("UTF-8")
|
||||||
case _ =>
|
case _ =>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue