Use jline2 for raw mode

Using the JLine3 implementation of raw mode breaks the scala console for
the console channel.
This commit is contained in:
Ethan Atkins 2020-07-19 12:50:42 -07:00
parent b678d2115f
commit a19ec581c0
1 changed files with 7 additions and 4 deletions

View File

@ -785,10 +785,13 @@ object Terminal {
system.setSize(new org.jline.terminal.Size(width, height))
override def withRawInput[T](f: => T): T = term.synchronized {
val prev = JLine3.enterRawMode(system)
try f
catch { case _: InterruptedIOException => throw new InterruptedException } finally {
setAttributes(prev)
try {
term.init()
term.setEchoEnabled(false)
f
} catch { case _: InterruptedIOException => throw new InterruptedException } finally {
term.restore()
term.setEchoEnabled(true)
}
}
override def isColorEnabled: Boolean =