Merge pull request #6337 from adpi2/fix-server-command

Fix size of server running message
This commit is contained in:
eugene yokota 2021-02-27 14:02:08 -05:00 committed by GitHub
commit 33e2bfe281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -156,7 +156,7 @@ private[sbt] final class ProgressState(
private[sbt] object ProgressState {
private val SERVER_IS_RUNNING = "sbt server is running "
// the + 2 is for the quotation marks
private val SERVER_IS_RUNNING_LENGTH = SERVER_IS_RUNNING.length + 2
private val SERVER_IS_RUNNING_LENGTH = SERVER_IS_RUNNING.length + 3
/**
* Receives a new task report and replaces the old one. In the event that the new
@ -174,7 +174,6 @@ private[sbt] object ProgressState {
val isRunning = terminal.prompt == Prompt.Running
val isBatch = terminal.prompt == Prompt.Batch
val isWatch = terminal.prompt == Prompt.Watch
val noPrompt = terminal.prompt == Prompt.NoPrompt
if (terminal.isSupershellEnabled) {
setShowProgress(true) // used by Zinc to not show "done compiling"
if (!pe.skipIfActive.getOrElse(false) || (!isRunning && !isBatch)) {
@ -193,8 +192,7 @@ private[sbt] object ProgressState {
pe.command.toSeq.flatMap { cmd =>
val width = terminal.getWidth
val sanitized = if ((cmd.length + SERVER_IS_RUNNING_LENGTH) > width) {
if (SERVER_IS_RUNNING_LENGTH + cmd.length < width) cmd
else cmd.take(cmd.length - 3 - SERVER_IS_RUNNING_LENGTH) + "..."
cmd.take(width - 3 - SERVER_IS_RUNNING_LENGTH) + "..."
} else cmd
val tail = if (isWatch) Nil else "enter 'cancel' to stop evaluation" :: Nil
s"$SERVER_IS_RUNNING '$sanitized'" :: tail