Print empty newlines with progress

With the latest sbt code, the `last` command displayed all of the output
without line separators. This occurred because the logic for appending
bytes to System.out split the input bytes on the line separator but if
there was nothing but the line separator in the input bytes then the
result was empty.
This commit is contained in:
Ethan Atkins 2020-11-20 11:32:45 -08:00
parent e2799f0cc1
commit 5fe89944bd
1 changed files with 4 additions and 1 deletions

View File

@ -111,7 +111,10 @@ private[sbt] final class ProgressState(
if (appendNewline) toWrite ++= lineSeparatorBytes
}
parts.dropRight(1).foreach(appendLine(_, true))
parts.lastOption.foreach(appendLine(_, bytes.endsWith(lineSeparatorBytes)))
parts.lastOption match {
case Some(l) => appendLine(l, bytes.endsWith(lineSeparatorBytes))
case None => toWrite ++= lineSeparatorBytes
}
} else toWrite ++= bytes
toWrite ++= clearScreenBytes
if (endsWithNewLine) {