From 5f85fe52d45199e3bf9a130b3fe91e3b44f8bd88 Mon Sep 17 00:00:00 2001 From: James Iry Date: Thu, 31 Jan 2013 16:49:31 -0800 Subject: SI-4714 Initialize history while initializing the REPL's reader It was possible to get a command into the REPL before the history recording object was set and so the command would be lost in the sands of time. This fix just moves the initialization of the history object into the JLineReader constructor, out of the post-init hook. --- src/compiler/scala/tools/nsc/interpreter/JLineReader.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala index 10f972452f..5fd5b41625 100644 --- a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala @@ -37,6 +37,9 @@ class JLineReader(_completion: => Completion) extends InteractiveReader { } class JLineConsoleReader extends ConsoleReader with ConsoleReaderHelper { + if ((history: History) ne NoHistory) + this setHistory history + // working around protected/trait/java insufficiencies. def goBack(num: Int): Unit = back(num) def readOneKey(prompt: String) = { @@ -51,8 +54,6 @@ class JLineReader(_completion: => Completion) extends InteractiveReader { // A hook for running code after the repl is done initializing. lazy val postInit: Unit = { this setBellEnabled false - if ((history: History) ne NoHistory) - this setHistory history if (completion ne NoCompletion) { val argCompletor: ArgumentCompleter = -- cgit v1.2.3