aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-09-20 10:39:12 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-10-10 13:25:35 +0200
commit68eae1a27da2ff6be1aa7747205d6e202d9ed781 (patch)
treefb844a808e541f49e2225bf673793f15ce6da859 /src
parentf1cc4f2a0c536989402c5ff667d3425e7a6e169d (diff)
downloaddotty-68eae1a27da2ff6be1aa7747205d6e202d9ed781.tar.gz
dotty-68eae1a27da2ff6be1aa7747205d6e202d9ed781.tar.bz2
dotty-68eae1a27da2ff6be1aa7747205d6e202d9ed781.zip
Indent 2 after newline in REPL
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/repl/AmmoniteReader.scala4
-rw-r--r--src/dotty/tools/dotc/repl/ammonite/filters/BasicFilters.scala5
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)),