Skip to content

Commit 19ffcb3

Browse files
committed
Fix line splitting
1 parent fa179d0 commit 19ffcb3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/src/dotty/tools/dotc/reporting/MessageRendering.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,12 @@ trait MessageRendering {
285285
case _ => false
286286
}
287287
val (line, rest0) = arr.span(!pred(_))
288-
val (_, rest) = rest0.span(pred)
289-
new String(line) :: { if (rest.isEmpty) Nil else linesFrom(rest) }
288+
// Only consume one line terminator (CRLF counts as one)
289+
val rest =
290+
if rest0.isEmpty then rest0
291+
else if rest0(0) == CR && rest0.length > 1 && rest0(1) == LF then rest0.drop(2)
292+
else rest0.drop(1)
293+
new String(line) :: { if rest.isEmpty then Nil else linesFrom(rest) }
290294
}
291295

292296
val lines = linesFrom(syntax)

0 commit comments

Comments
 (0)