summaryrefslogtreecommitdiff
path: root/src/repl
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2017-02-12 21:27:38 -0800
committerSom Snytt <som.snytt@gmail.com>2017-02-13 02:48:09 -0800
commitf7c17d2d8f0b5a3c23f2551fb2071e72e0f368c2 (patch)
tree09ebaf5f5a68af26f2ad8594466059b9c34c2893 /src/repl
parent502e3c6296e5e997549b7e496e0bbfa62c522110 (diff)
downloadscala-f7c17d2d8f0b5a3c23f2551fb2071e72e0f368c2.tar.gz
scala-f7c17d2d8f0b5a3c23f2551fb2071e72e0f368c2.tar.bz2
scala-f7c17d2d8f0b5a3c23f2551fb2071e72e0f368c2.zip
EOL is System.lineSeparator
The old EOL is EOL. Use `println()` when feasible and obvious. Minor cleanup of surrounding code.
Diffstat (limited to 'src/repl')
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ILoop.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
index d03924b158..9635f320fe 100644
--- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
@@ -1029,6 +1029,7 @@ object ILoop {
// like if you'd just typed it into the repl.
def runForTranscript(code: String, settings: Settings, inSession: Boolean = false): String = {
import java.io.{ BufferedReader, StringReader, OutputStreamWriter }
+ import java.lang.System.{lineSeparator => EOL}
stringFromStream { ostream =>
Console.withOut(ostream) {
@@ -1036,10 +1037,9 @@ object ILoop {
// skip margin prefix for continuation lines, unless preserving session text for test
// should test for repl.paste.ContinueString or replProps.continueText.contains(ch)
override def write(str: String) =
- if (!inSession && (str forall (ch => ch.isWhitespace || ch == '|'))) ()
- else super.write(str)
+ if (inSession || (str.exists(ch => ch != ' ' && ch != '|'))) super.write(str)
}
- val input = new BufferedReader(new StringReader(code.trim + "\n")) {
+ val input = new BufferedReader(new StringReader(s"${code.trim}${EOL}")) {
override def readLine(): String = {
mark(1) // default buffer is 8k
val c = read()