diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/repl/scala/tools/nsc/interpreter/ILoop.scala | 9 | ||||
-rw-r--r-- | src/repl/scala/tools/nsc/interpreter/ReplProps.scala | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala index b4fa5b607c..bf7c8551e5 100644 --- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala @@ -734,10 +734,13 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) } getOrElse "" case (eof, _) => echo(s"// Entering paste mode (${ eof getOrElse "ctrl-D" } to finish)\n") - val input = readWhile(s => eof.isEmpty || eof.get != s) mkString "\n" + val delimiter = eof orElse replProps.pasteDelimiter.option + val input = readWhile(s => delimiter.isEmpty || delimiter.get != s) mkString "\n" val text = ( - margin filter (_.nonEmpty) map (input stripMargin _.head) // ignore excess chars in "<<||" - getOrElse input + margin filter (_.nonEmpty) map { + case "-" => input.lines map (_.trim) mkString "\n" + case m => input stripMargin m.head // ignore excess chars in "<<||" + } getOrElse input ).trim if (text.isEmpty) echo("\n// Nothing pasted, nothing gained.\n") else echo("\n// Exiting paste mode, now interpreting.\n") diff --git a/src/repl/scala/tools/nsc/interpreter/ReplProps.scala b/src/repl/scala/tools/nsc/interpreter/ReplProps.scala index 588d92f81b..f3115d9800 100644 --- a/src/repl/scala/tools/nsc/interpreter/ReplProps.scala +++ b/src/repl/scala/tools/nsc/interpreter/ReplProps.scala @@ -64,6 +64,8 @@ class ReplProps { if (p.isSet) p.get else shellWelcomeString } + val pasteDelimiter = Prop[String]("scala.repl.here") + /** CSV of paged,across to enable pagination or `-x` style * columns, "across" instead of down the column. Since * pagination turns off columnar output, these flags are |