Merge pull request #227 from eatkins/delete-line-count

Don't include DeleteLine in progress length
This commit is contained in:
Ethan Atkins 2019-10-07 15:13:03 -07:00 committed by GitHub
commit 166511c992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()