diff --git a/src/vs/workbench/contrib/debug/browser/debugANSIHandling.ts b/src/vs/workbench/contrib/debug/browser/debugANSIHandling.ts index 9894e465b203575500b48f2ede3d89e8f95863e1..df8f1dc2b3b4bfc8d95c6f5550da5933d3d7df46 100644 --- a/src/vs/workbench/contrib/debug/browser/debugANSIHandling.ts +++ b/src/vs/workbench/contrib/debug/browser/debugANSIHandling.ts @@ -72,16 +72,20 @@ export function handleANSIOutput(text: string, linkDetector: LinkDetector): HTML styleNames.push('code-italic'); } else if (code === 4) { styleNames.push('code-underline'); - } else if ((code >= 30 && code <= 37) || (code >= 90 && code <= 97)) { - styleNames.push('code-foreground-' + code); - } else if (code === 39) { - // Remove all foreground colour codes + } else if (code === 39 || (code >= 30 && code <= 37) || (code >= 90 && code <= 97)) { + // Remove all previous foreground colour codes styleNames = styleNames.filter(style => !style.match(/^code-foreground-\d+$/)); - } else if ((code >= 40 && code <= 47) || (code >= 100 && code <= 107)) { - styleNames.push('code-background-' + code); - } else if (code === 49) { - // Remove all background colour codes + + if (code !== 39) { + styleNames.push('code-foreground-' + code); + } + } else if (code === 49 || (code >= 40 && code <= 47) || (code >= 100 && code <= 107)) { + // Remove all previous background colour codes styleNames = styleNames.filter(style => !style.match(/^code-background-\d+$/)); + + if (code !== 49) { + styleNames.push('code-background-' + code); + } } }