Skip to content

Commit

Permalink
Merge pull request scala#5777 from som-snytt/issue/10226
Browse files Browse the repository at this point in the history
SI-10226 REPL handles paste when colorized
  • Loading branch information
lrytz authored Mar 15, 2017
2 parents d0c2620 + c77b420 commit 0dab108
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/repl/scala/tools/nsc/interpreter/ILoop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
result
}

private object paste extends Pasted(prompt) {
private object paste extends Pasted(replProps.promptText) {
def interpret(line: String) = intp interpret line
def echo(message: String) = ILoop.this echo message

Expand Down
7 changes: 3 additions & 4 deletions src/repl/scala/tools/nsc/interpreter/Pasted.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ abstract class Pasted(prompt: String) {
def matchesContinue(line: String) = matchesString(line, ContinueString)
def running = isRunning

private def matchesString(line: String, target: String): Boolean = (
(line startsWith target) ||
(line.nonEmpty && spacey(line.head) && matchesString(line.tail, target))
)
private def matchesString(line: String, target: String): Boolean =
line.startsWith(target) || (line.nonEmpty && spacey(line.head) && matchesString(line.tail, target))

private def stripString(line: String, target: String) = line indexOf target match {
case -1 => line
case idx => line drop (idx + target.length)
Expand Down

0 comments on commit 0dab108

Please sign in to comment.