summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-01-31 16:49:31 -0800
committerJames Iry <jamesiry@gmail.com>2013-01-31 16:49:31 -0800
commit5f85fe52d45199e3bf9a130b3fe91e3b44f8bd88 (patch)
tree16aa36e40f04bbcb991a363cb94b71c39604ad58
parentd672102fd8bf86fcdb53f1a063072d430d1c1fbb (diff)
downloadscala-5f85fe52d45199e3bf9a130b3fe91e3b44f8bd88.tar.gz
scala-5f85fe52d45199e3bf9a130b3fe91e3b44f8bd88.tar.bz2
scala-5f85fe52d45199e3bf9a130b3fe91e3b44f8bd88.zip
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.
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/JLineReader.scala5
1 files changed, 3 insertions, 2 deletions
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 =