From f300b28c55d3b4707873709a55d21fac14c5c066 Mon Sep 17 00:00:00 2001 From: Peter Mularien Date: Fri, 2 Jan 2015 16:16:23 -0500 Subject: [PATCH] Fix issue with line spacing in Code Grid report on Windows, due to the .split method being translated by StringLike.split into a regex [\r\n] which will cause 2 lines in the resultant array. Issue is resolved if treating as a single String, which will invoke the Java String.split(String regex) method, and correctly treat the "\r\n" as a single expression. This should work correctly on other platforms with a single character line ending (Unix and Mac). --- .../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 37e23d47..bde5bb36 100644 --- a/scalac-scoverage-plugin/src/main/scala/scoverage/report/CodeGrid.scala +++ b/scalac-scoverage-plugin/src/main/scala/scoverage/report/CodeGrid.scala @@ -9,7 +9,7 @@ class CodeGrid(mfile: MeasuredFile) { case class Cell(char: Char, var status: StatementStatus) - private val lineBreak = System.getProperty("line.separator").toCharArray + private val lineBreak = System.getProperty("line.separator") // note: we must reinclude the line sep to keep source positions correct. private val lines = source(mfile).split(lineBreak).map(line => (line.toCharArray ++ lineBreak).map(Cell(_, NoData)))