Skip to content

Commit cd1006c

Browse files
committed
Revert "Repl prints '\n' as newline, not "^J""
This reverts commit d571fa0 (scala#5450). Superseded by upgrade to jline2 2.14.3 (jline/jline2@01969b5)
1 parent 55f596b commit cd1006c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/repl-jline/scala/tools/nsc/interpreter/jline/JLineReader.scala

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,11 @@ private class JLineConsoleReader extends jconsole.ConsoleReader with interpreter
9494
printColumns_(items: List[String])
9595
}
9696

97-
// Workaround for JLine weirdness. (See https://github.com/scala/scala-dev/issues/240)
98-
// Emit control characters as-is, instead of representing them as e.g. "^J" (for '\n').
99-
// `rawPrint` is package protected in jline.console.ConsoleReader, while `rawPrintln` is private
100-
// Copy/paste part of it as `_rawPrint` (to avoid name clash);
101-
// the super class impl also sets `cursorOk`, but that's out of reach for us.
102-
private def _rawPrint(str: String) = getOutput.write(str)
103-
private def rawPrintln(str: String) = { _rawPrint(str); println() }
104-
10597
private def printColumns_(items: List[String]): Unit = if (items exists (_ != "")) {
10698
val grouped = tabulate(items)
10799
var linesLeft = if (isPaginationEnabled()) height - 1 else Int.MaxValue
108100
grouped foreach { xs =>
109-
rawPrintln(xs.mkString)
101+
println(xs.mkString)
110102
linesLeft -= 1
111103
if (linesLeft <= 0) {
112104
linesLeft = emulateMore()
@@ -117,7 +109,7 @@ private class JLineConsoleReader extends jconsole.ConsoleReader with interpreter
117109
}
118110

119111
def readOneKey(prompt: String) = {
120-
_rawPrint(prompt)
112+
this.print(prompt)
121113
this.flush()
122114
this.readCharacter()
123115
}

0 commit comments

Comments
 (0)