Don't include DeleteLine in progress length

I incorrectly included the DeleteLine in the progress line length and
this could cause certain progress lines to be incorrectly reported as
multi line when they actually fit on a single terminal line.
This commit is contained in:
Ethan Atkins 2019-10-06 17:51:20 -07:00
parent 0c9ac98b08
commit 43f25520a0
1 changed files with 8 additions and 3 deletions

View File

@ -349,13 +349,18 @@ class ConsoleAppender private[ConsoleAppender] (
val width = ConsoleAppender.terminalWidth
val len: Int = progress.foldLeft(progress.length)(_ + terminalLines(width)(_))
deleteConsoleLines(blankZone + pad)
progress.foreach(out.println)
progress.foreach(printProgressLine)
out.print(cursorUp(blankZone + len + padding.get))
}
}
out.flush()
}
private def printProgressLine(line: String): Unit = {
out.print(DeleteLine)
out.println(line)
}
/**
* Receives a new task report and replaces the old one. In the event that the new
* report has fewer lines than the previous report, padding lines are added on top
@ -369,7 +374,7 @@ class ConsoleAppender private[ConsoleAppender] (
val sorted = pe.items.sortBy(x => x.elapsedMicros)
val info = sorted map { item =>
val elapsed = item.elapsedMicros / 1000000L
s"$DeleteLine | => ${item.name} ${elapsed}s"
s" | => ${item.name} ${elapsed}s"
}
val width = ConsoleAppender.terminalWidth
@ -383,7 +388,7 @@ class ConsoleAppender private[ConsoleAppender] (
deleteConsoleLines(newPadding)
deleteConsoleLines(blankZone)
info.foreach(i => out.println(i))
info.foreach(printProgressLine)
out.print(cursorUp(blankZone + currentLength + newPadding))
out.flush()