From 883952c0bad83795339d33945882344ec576c02d Mon Sep 17 00:00:00 2001 From: Grzegorz Slowikowski Date: Tue, 25 Oct 2016 16:58:22 +0200 Subject: [PATCH] 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. --- .../src/main/scala/scoverage/report/CodeGrid.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scalac-scoverage-plugin/src/main/scala/scoverage/report/CodeGrid.scala b/scalac-scoverage-plugin/src/main/scala/scoverage/report/CodeGrid.scala index 30022b74..5af95e3a 100644 --- a/scalac-scoverage-plugin/src/main/scala/scoverage/report/CodeGrid.scala +++ b/scalac-scoverage-plugin/src/main/scala/scoverage/report/CodeGrid.scala @@ -14,7 +14,7 @@ class CodeGrid(mFile: MeasuredFile, sourceEncoding: Option[String]) { case class Cell(char: Char, var status: StatementStatus) - private val lineBreak = System.getProperty("line.separator") + private val lineBreak = "\n" // Array of lines, each line is an array of cells, where a cell is a character + coverage info for that position // All cells default to NoData until the highlighted information is applied