mirror of https://github.com/sbt/sbt.git
init/restore instead of setEchoEnabled in order to handle full jline customizations. Fixes #822.
This commit is contained in:
parent
ab5e81fc23
commit
033829d4a0
|
|
@ -57,7 +57,7 @@ abstract class JLine extends LineReader
|
||||||
private[this] def resume()
|
private[this] def resume()
|
||||||
{
|
{
|
||||||
jline.TerminalFactory.reset
|
jline.TerminalFactory.reset
|
||||||
JLine.terminal.setEchoEnabled(false)
|
JLine.terminal.init
|
||||||
reader.drawLine()
|
reader.drawLine()
|
||||||
reader.flush()
|
reader.flush()
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +95,7 @@ private object JLine
|
||||||
* This ensures synchronized access as well as re-enabling echo after getting the Terminal. */
|
* This ensures synchronized access as well as re-enabling echo after getting the Terminal. */
|
||||||
def usingTerminal[T](f: jline.Terminal => T): T =
|
def usingTerminal[T](f: jline.Terminal => T): T =
|
||||||
withTerminal { t =>
|
withTerminal { t =>
|
||||||
t.setEchoEnabled(true)
|
t.restore
|
||||||
f(t)
|
f(t)
|
||||||
}
|
}
|
||||||
def createReader(): ConsoleReader = createReader(None)
|
def createReader(): ConsoleReader = createReader(None)
|
||||||
|
|
@ -114,9 +114,9 @@ private object JLine
|
||||||
}
|
}
|
||||||
def withJLine[T](action: => T): T =
|
def withJLine[T](action: => T): T =
|
||||||
withTerminal { t =>
|
withTerminal { t =>
|
||||||
t.setEchoEnabled(false)
|
t.init
|
||||||
try { action }
|
try { action }
|
||||||
finally { t.setEchoEnabled(true) }
|
finally { t.restore }
|
||||||
}
|
}
|
||||||
|
|
||||||
def simple(historyPath: Option[File], handleCONT: Boolean = HandleCONT): SimpleReader = new SimpleReader(historyPath, handleCONT)
|
def simple(historyPath: Option[File], handleCONT: Boolean = HandleCONT): SimpleReader = new SimpleReader(historyPath, handleCONT)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ object JLineTest
|
||||||
import jline.TerminalFactory
|
import jline.TerminalFactory
|
||||||
import jline.console.ConsoleReader
|
import jline.console.ConsoleReader
|
||||||
val reader = new ConsoleReader()
|
val reader = new ConsoleReader()
|
||||||
TerminalFactory.get.setEchoEnabled(false)
|
TerminalFactory.get.init
|
||||||
|
|
||||||
val parser = parsers(args(0))
|
val parser = parsers(args(0))
|
||||||
JLineCompletion.installCustomCompletor(reader, parser)
|
JLineCompletion.installCustomCompletor(reader, parser)
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ object ConsoleLogger
|
||||||
private[this] def ansiSupported =
|
private[this] def ansiSupported =
|
||||||
try {
|
try {
|
||||||
val terminal = jline.TerminalFactory.get
|
val terminal = jline.TerminalFactory.get
|
||||||
terminal.setEchoEnabled(true) // #460
|
terminal.restore // #460
|
||||||
terminal.isAnsiSupported
|
terminal.isAnsiSupported
|
||||||
} catch {
|
} catch {
|
||||||
case e: Exception => !isWindows
|
case e: Exception => !isWindows
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue