mirror of https://github.com/sbt/sbt.git
another fix related to #460
This commit is contained in:
parent
e34b8e4bf2
commit
cf2402cea4
|
|
@ -57,7 +57,7 @@ object Graph
|
||||||
// [info] |
|
// [info] |
|
||||||
// [info] +-quux
|
// [info] +-quux
|
||||||
def toAscii[A](top: A, children: A => Seq[A], display: A => String): String = {
|
def toAscii[A](top: A, children: A => Seq[A], display: A => String): String = {
|
||||||
val maxColumn = jline.Terminal.getTerminal.getTerminalWidth - 8
|
val maxColumn = JLine.usingTerminal(_.getTerminalWidth) - 8
|
||||||
val twoSpaces = " " + " " // prevent accidentally being converted into a tab
|
val twoSpaces = " " + " " // prevent accidentally being converted into a tab
|
||||||
def limitLine(s: String): String =
|
def limitLine(s: String): String =
|
||||||
if (s.length > maxColumn) s.slice(0, maxColumn - 2) + ".."
|
if (s.length > maxColumn) s.slice(0, maxColumn - 2) + ".."
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,16 @@ private object JLine
|
||||||
val t = terminal
|
val t = terminal
|
||||||
t.synchronized { f(t) }
|
t.synchronized { f(t) }
|
||||||
}
|
}
|
||||||
def createReader() =
|
/** For accessing the JLine Terminal object.
|
||||||
|
* This ensures synchronized access as well as re-enabling echo after getting the Terminal. */
|
||||||
|
def usingTerminal[T](f: jline.Terminal => T): T =
|
||||||
withTerminal { t =>
|
withTerminal { t =>
|
||||||
val cr = new ConsoleReader
|
|
||||||
t.enableEcho()
|
t.enableEcho()
|
||||||
|
f(t)
|
||||||
|
}
|
||||||
|
def createReader() =
|
||||||
|
usingTerminal { t =>
|
||||||
|
val cr = new ConsoleReader
|
||||||
cr.setBellEnabled(false)
|
cr.setBellEnabled(false)
|
||||||
cr
|
cr
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue