diff options
author | Nicolas Stucki <nicolas.stucki@gmail.com> | 2016-07-27 09:25:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-27 09:25:59 +0200 |
commit | 9396006ab3e52727110bb4b46b141e2d7601b15d (patch) | |
tree | 6665d116417dbb4497458621698ee45f7527f207 /src | |
parent | 1b0315caaf5edfab2583ea9d2609427ab5cde04e (diff) | |
parent | 8f3b6203d5dd86f84580daa56b3425e1329cfc11 (diff) | |
download | dotty-9396006ab3e52727110bb4b46b141e2d7601b15d.tar.gz dotty-9396006ab3e52727110bb4b46b141e2d7601b15d.tar.bz2 dotty-9396006ab3e52727110bb4b46b141e2d7601b15d.zip |
Merge pull request #1416 from dotty-staging/fix/Xprint-colors
-Xprint-diff-del: more meaningful colors
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/util/DiffUtil.scala | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/util/DiffUtil.scala b/src/dotty/tools/dotc/util/DiffUtil.scala index 6718ccbf8..b28f36382 100644 --- a/src/dotty/tools/dotc/util/DiffUtil.scala +++ b/src/dotty/tools/dotc/util/DiffUtil.scala @@ -8,8 +8,9 @@ object DiffUtil { private final val ANSI_DEFAULT = "\u001B[0m" private final val ANSI_RED = "\u001B[31m" private final val ANSI_GREEN = "\u001B[32m" - private final val ANSI_YELLOW = "\u001B[33m" - private final val ANSI_MAGENTA = "\u001B[35m" + + private final val DELETION_COLOR = ANSI_RED + private final val ADDITION_COLOR = ANSI_GREEN def mkColoredCodeDiff(code: String, lastCode: String, printDiffDel: Boolean): String = { import scala.collection.JavaConversions._ @@ -42,19 +43,19 @@ object DiffUtil { delta.getType.toString match { // Issue #1355 forces us to use the toString case "INSERT" => - lines(pos) = ANSI_GREEN + lines(pos) + lines(pos) = ADDITION_COLOR + lines(pos) lines(endPos) = lines(endPos) + ANSI_DEFAULT case "CHANGE" => val old = if (!printDiffDel) "" else - ANSI_MAGENTA + delta.getOriginal.getLines.mkString + ANSI_DEFAULT - lines(pos) = old + ANSI_YELLOW + lines(pos) + DELETION_COLOR + delta.getOriginal.getLines.mkString + ANSI_DEFAULT + lines(pos) = old + ADDITION_COLOR + lines(pos) lines(endPos) = lines(endPos) + ANSI_DEFAULT case "DELETE" if printDiffDel => val deleted = delta.getOriginal.getLines.mkString if (!deleted.forall(Character.isWhitespace)) { - lines(pos) = ANSI_RED + deleted + ANSI_DEFAULT + lines(pos) + lines(pos) = DELETION_COLOR + deleted + ANSI_DEFAULT + lines(pos) } case _ => |