File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
compiler/src/dotty/tools/repl Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -92,11 +92,13 @@ final class JLineTerminal extends java.io.Closeable {
92
92
93
93
context match {
94
94
case ParseContext .ACCEPT_LINE =>
95
- val lastLineOffset = line.lastIndexOfSlice(System .lineSeparator)
96
- if (cursor <= lastLineOffset || ParseResult .isIncomplete(line)) incomplete()
95
+ // ENTER means SUBMIT when
96
+ // - cursor is at end (discarding whitespaces)
97
+ // - and, input line is complete
98
+ val cursorIsAtEnd = line.indexWhere(! _.isWhitespace, from = cursor) >= 0
99
+ if (cursorIsAtEnd || ParseResult .isIncomplete(line)) incomplete()
97
100
else parsedLine(" " , 0 )
98
- // using dummy values,
99
- // resulting parsed line is probably unused
101
+ // using dummy values, resulting parsed line is probably unused
100
102
101
103
case ParseContext .COMPLETE =>
102
104
// Parse to find completions (typically after a Tab).
You can’t perform that action at this time.
0 commit comments