mirror of
https://github.com/sbt/sbt.git
synced 2026-09-01 02:27:13 +02:00
InteractionService#terminalWidth
Adds `def terminalWidth: Int` to InteractionService to wrap JLine 2 (or 3 in the future). Fixes #3352
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.SimpleReader
|
||||
import sbt.internal.util.{ JLine, SimpleReader }
|
||||
|
||||
trait CommandLineUIService extends InteractionService {
|
||||
override def readLine(prompt: String, mask: Boolean): Option[String] = {
|
||||
@@ -19,6 +19,10 @@ trait CommandLineUIService extends InteractionService {
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
|
||||
override def terminalWidth: Int = JLine.usingTerminal(_.getWidth)
|
||||
|
||||
override def terminalHeight: Int = JLine.usingTerminal(_.getHeight)
|
||||
}
|
||||
|
||||
object CommandLineUIService extends CommandLineUIService
|
||||
|
||||
@@ -13,5 +13,9 @@ abstract class InteractionService {
|
||||
/** Ask the user to confirm something (yes or no) before continuing. */
|
||||
def confirm(msg: String): Boolean
|
||||
|
||||
def terminalWidth: Int
|
||||
|
||||
def terminalHeight: Int
|
||||
|
||||
// TODO - Ask for input with autocomplete?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user