REPL: print newline before exit

No tests added because the only way to test this seems to be to launch a
new process and send "Ctrl+D" into it, which seems cumbersome for such
small change
This commit is contained in:
Alexander Udalov
2016-01-31 22:35:45 +05:30
parent 6f22baa0f6
commit bd9dd90649
@@ -17,6 +17,17 @@
package org.jetbrains.kotlin.cli.jvm.repl.messages
class ReplConsoleWriter : ReplWriter {
init {
Runtime.getRuntime().addShutdownHook(object : Thread("Kotlin REPL shutdown hook") {
override fun run() {
// Print an empty line to make the command prompt start from the beginning of the line after REPL exits.
// This is essentially a workaround of a jline2 bug.
// TODO: remove this as soon as we update to jline3
println()
}
})
}
override fun printlnWelcomeMessage(x: String) = println(x)
override fun printlnHelpMessage(x: String) = println(x)
override fun outputCompileError(x: String) = println(x)