Skip to content

Commit 7670223

Browse files
committed
Fix #3614: Do not allow the SyntaxFormatter to recolor code
1 parent 63e491a commit 7670223

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/printing/Formatting.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ object Formatting {
8686
case hb: HighlightBuffer =>
8787
hb.toString
8888
case str: String if ctx.settings.color.value != "never" =>
89-
new String(SyntaxHighlighting(str).toArray)
89+
if (str.matches(".*\u001b\\[.*?m.*")) str // was already colored by some other printer
90+
else new String(SyntaxHighlighting(str).toArray)
9091
case _ => super.showArg(arg)
9192
}
9293
}

0 commit comments

Comments
 (0)