Skip to content

Commit 883952c

Browse files
committed
Fix splitting source into lines on Windows OS when source file contains Linux line ending characters ("\n").
In this case code grid report doesn't split source file into lines at all because it tries to split on Windows line ending sequence ("\r\n") and there is no such sequence in source file. '\r' characters should be treated as every other character (as it's treated now on Linux OS when source file contains Windows line ending sequences). Only '\n' characters should be used to split source into lines. It will work even if source file has mixed line endings.
1 parent 2e6039d commit 883952c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scalac-scoverage-plugin/src/main/scala/scoverage/report/CodeGrid.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CodeGrid(mFile: MeasuredFile, sourceEncoding: Option[String]) {
1414

1515
case class Cell(char: Char, var status: StatementStatus)
1616

17-
private val lineBreak = System.getProperty("line.separator")
17+
private val lineBreak = "\n"
1818

1919
// Array of lines, each line is an array of cells, where a cell is a character + coverage info for that position
2020
// All cells default to NoData until the highlighted information is applied

0 commit comments

Comments
 (0)