summaryrefslogtreecommitdiff
path: root/src/repl/scala/tools/nsc/interpreter/ILoop.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2015-06-22 22:39:36 -0700
committerSom Snytt <som.snytt@gmail.com>2015-06-23 15:52:44 -0700
commiteab44dd09223974c7515a2413bc461ee3808d682 (patch)
tree290ac11a90e616b67a09a15ebc100174dfaee57d /src/repl/scala/tools/nsc/interpreter/ILoop.scala
parent2ceb09c1a51694d1a17378ee8833154aa59b6c58 (diff)
downloadscala-eab44dd09223974c7515a2413bc461ee3808d682.tar.gz
scala-eab44dd09223974c7515a2413bc461ee3808d682.tar.bz2
scala-eab44dd09223974c7515a2413bc461ee3808d682.zip
SI-9206 REPL custom continuation prompt
Because who doesn't want to customize their continuation prompt? `scala -Dscala.repl.continue="..."` looks especially nice with `-Dscala.color`. Somewhat works when pasting, but the test rig for running a transcript does not seek to support custom secondary prompts.
Diffstat (limited to 'src/repl/scala/tools/nsc/interpreter/ILoop.scala')
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ILoop.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
index 7262aab425..6470a450b2 100644
--- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
@@ -753,7 +753,8 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
private object paste extends Pasted {
import scala.util.matching.Regex.quote
- val ContinueString = " | "
+ val ContinuePrompt = replProps.continuePrompt
+ val ContinueString = replProps.continueText // " | "
val PromptString = prompt.lines.toList.last
val anyPrompt = s"""\\s*(?:${quote(PromptString.trim)}|${quote(AltPromptString.trim)})\\s*""".r
@@ -797,7 +798,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
echo("You typed two blank lines. Starting a new command.")
None
case IR.Incomplete =>
- in.readLine(paste.ContinueString) match {
+ in.readLine(paste.ContinuePrompt) match {
case null =>
// we know compilation is going to fail since we're at EOF and the
// parser thinks the input is still incomplete, but since this is
@@ -940,8 +941,9 @@ object ILoop {
Console.withOut(ostream) {
val output = new JPrintWriter(new OutputStreamWriter(ostream), true) {
// 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 == '|'))) () // repl.paste.ContinueString
+ if (!inSession && (str forall (ch => ch.isWhitespace || ch == '|'))) ()
else super.write(str)
}
val input = new BufferedReader(new StringReader(code.trim + "\n")) {