init/restore instead of setEchoEnabled in order to handle full jline customizations. Fixes #822.

This commit is contained in:
Mark Harrah 2013-07-19 20:02:46 -04:00
parent ab5e81fc23
commit 033829d4a0
3 changed files with 6 additions and 6 deletions

View File

@ -57,7 +57,7 @@ abstract class JLine extends LineReader
private[this] def resume()
{
jline.TerminalFactory.reset
JLine.terminal.setEchoEnabled(false)
JLine.terminal.init
reader.drawLine()
reader.flush()
}
@ -95,7 +95,7 @@ private object JLine
* This ensures synchronized access as well as re-enabling echo after getting the Terminal. */
def usingTerminal[T](f: jline.Terminal => T): T =
withTerminal { t =>
t.setEchoEnabled(true)
t.restore
f(t)
}
def createReader(): ConsoleReader = createReader(None)
@ -114,9 +114,9 @@ private object JLine
}
def withJLine[T](action: => T): T =
withTerminal { t =>
t.setEchoEnabled(false)
t.init
try { action }
finally { t.setEchoEnabled(true) }
finally { t.restore }
}
def simple(historyPath: Option[File], handleCONT: Boolean = HandleCONT): SimpleReader = new SimpleReader(historyPath, handleCONT)

View File

@ -21,7 +21,7 @@ object JLineTest
import jline.TerminalFactory
import jline.console.ConsoleReader
val reader = new ConsoleReader()
TerminalFactory.get.setEchoEnabled(false)
TerminalFactory.get.init
val parser = parsers(args(0))
JLineCompletion.installCustomCompletor(reader, parser)

View File

@ -83,7 +83,7 @@ object ConsoleLogger
private[this] def ansiSupported =
try {
val terminal = jline.TerminalFactory.get
terminal.setEchoEnabled(true) // #460
terminal.restore // #460
terminal.isAnsiSupported
} catch {
case e: Exception => !isWindows