diff options
-rw-r--r-- | src/dotty/tools/dotc/repl/AmmoniteReader.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/repl/ammonite/filters/BasicFilters.scala | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/repl/AmmoniteReader.scala b/src/dotty/tools/dotc/repl/AmmoniteReader.scala index 435269081..f3b68e4b0 100644 --- a/src/dotty/tools/dotc/repl/AmmoniteReader.scala +++ b/src/dotty/tools/dotc/repl/AmmoniteReader.scala @@ -28,8 +28,8 @@ class AmmoniteReader(val interpreter: Interpreter)(implicit ctx: Context) extend val selectionFilter = GUILikeFilters.SelectionFilter(indent = 2) val multilineFilter: Filter = Filter("multilineFilter") { case TermState(lb ~: rest, b, c, _) - if (lb == 10 || lb == 13) && incompleteInput(b.mkString) => - BasicFilters.injectNewLine(b, c, rest) + if (lb == 10 || lb == 13) && incompleteInput(b.mkString) => + BasicFilters.injectNewLine(b, c, rest, indent = 2) } def readLine(prompt: String): String = { diff --git a/src/dotty/tools/dotc/repl/ammonite/filters/BasicFilters.scala b/src/dotty/tools/dotc/repl/ammonite/filters/BasicFilters.scala index ebbcf2148..faa97c348 100644 --- a/src/dotty/tools/dotc/repl/ammonite/filters/BasicFilters.scala +++ b/src/dotty/tools/dotc/repl/ammonite/filters/BasicFilters.scala @@ -25,12 +25,11 @@ object BasicFilters { typingFilter ) - def injectNewLine(b: Vector[Char], c: Int, rest: LazyList[Int]) = { + def injectNewLine(b: Vector[Char], c: Int, rest: LazyList[Int], indent: Int = 0) = { val (first, last) = b.splitAt(c) - TermState(rest, (first :+ '\n') ++ last, c + 1) + TermState(rest, (first :+ '\n') ++ last ++ Vector.fill(indent)(' '), c + 1 + indent) } - def navFilter = Filter.merge( Case(Up)((b, c, m) => moveUp(b, c, m.width)), Case(Down)((b, c, m) => moveDown(b, c, m.width)), |