mirror of https://github.com/sbt/sbt.git
Clear supershell lines before suppressed task
I noticed that when entering the console, I'd often be left with a supershell line at the bottom of the screen that would eventually get interlaced with my console commands. This can be eliminated by clearing the supershell progress before evaluating the task if it is one of the skip tasks.
This commit is contained in:
parent
95e3c5c335
commit
3ab5040bc7
|
|
@ -57,6 +57,10 @@ private[sbt] final class TaskProgress(log: ManagedLogger)
|
|||
ConsoleAppender.setTerminalWidth(JLine.terminal.getWidth)
|
||||
}
|
||||
|
||||
override def beforeWork(task: Task[_]): Unit = {
|
||||
super.beforeWork(task)
|
||||
if (containsSkipTasks(Vector(task)) || lastTaskCount.get == 0) report()
|
||||
}
|
||||
override def afterReady(task: Task[_]): Unit = ()
|
||||
|
||||
override def afterCompleted[A](task: Task[A], result: Result[A]): Unit = ()
|
||||
|
|
@ -76,10 +80,10 @@ private[sbt] final class TaskProgress(log: ManagedLogger)
|
|||
val currentTasks = activeTasks.toVector.filterNot(Def.isDummy)
|
||||
val ltc = lastTaskCount.get
|
||||
val currentTasksCount = currentTasks.size
|
||||
def report0(): Unit = {
|
||||
def report0(tasks: Vector[Task[_]]): Unit = {
|
||||
val event = ProgressEvent(
|
||||
"Info",
|
||||
currentTasks
|
||||
tasks
|
||||
.map { task =>
|
||||
val elapsed = timings.get(task).currentElapsedMicros
|
||||
ProgressItem(taskName(task), elapsed)
|
||||
|
|
@ -92,9 +96,15 @@ private[sbt] final class TaskProgress(log: ManagedLogger)
|
|||
import sbt.internal.util.codec.JsonProtocol._
|
||||
log.logEvent(Level.Info, event)
|
||||
}
|
||||
if (containsSkipTasks(currentTasks)) ()
|
||||
else report0()
|
||||
lastTaskCount.set(currentTasksCount)
|
||||
if (containsSkipTasks(currentTasks)) {
|
||||
if (ltc > 0) {
|
||||
lastTaskCount.set(0)
|
||||
report0(Vector.empty)
|
||||
}
|
||||
} else {
|
||||
lastTaskCount.set(currentTasksCount)
|
||||
report0(currentTasks)
|
||||
}
|
||||
}
|
||||
|
||||
private[this] def containsSkipTasks(tasks: Vector[Task[_]]): Boolean = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue