Merge pull request #5690 from eatkins/jline2-raw-mode

Use jline2 for raw mode
This commit is contained in:
eugene yokota 2020-07-20 07:23:07 -04:00 committed by GitHub
commit e985d77ace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 =