From 59413761fbad544c290b9f254b36746ecb6f4b83 Mon Sep 17 00:00:00 2001 From: Allan Renucci Date: Sat, 30 Jun 2018 11:22:12 +0200 Subject: [PATCH] Address review in JLine PR --- compiler/src/dotty/tools/repl/JLineTerminal.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/repl/JLineTerminal.scala b/compiler/src/dotty/tools/repl/JLineTerminal.scala index d73bc295fe78..cfa3620f98a1 100644 --- a/compiler/src/dotty/tools/repl/JLineTerminal.scala +++ b/compiler/src/dotty/tools/repl/JLineTerminal.scala @@ -122,10 +122,11 @@ final class JLineTerminal extends java.io.Closeable { // ENTER means SUBMIT when // - cursor is at end (discarding whitespaces) // - and, input line is complete - val cursorIsAtEnd = line.indexWhere(!_.isWhitespace, from = cursor) >= 0 - if (cursorIsAtEnd || ParseResult.isIncomplete(line)) incomplete() - else defaultParsedLine - // using dummy values, resulting parsed line is probably unused + val cursorIsAtEnd = line.indexWhere(!_.isWhitespace, from = cursor) < 0 + if (cursorIsAtEnd && !ParseResult.isIncomplete(line)) + defaultParsedLine // using dummy values, resulting parsed line is probably unused + else + incomplete() case ParseContext.COMPLETE => // Parse to find completions (typically after a Tab).