mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
remove background colors from combination setters as well (#245734)
This commit is contained in:
@@ -11,6 +11,7 @@ export function formatStackTrace(stack: string): { formattedStack: string; error
|
||||
// Remove background colors. The ones from IPython don't work well with
|
||||
// themes 40-49 sets background color
|
||||
cleaned = stack.replace(/\u001b\[4\dm/g, '');
|
||||
cleaned = cleaned.replace(/(?<=\u001b\[[\d;]*?);4\d(?=m)/g, '');
|
||||
|
||||
// Also remove specific foreground colors (38 is the ascii code for picking one) (they don't translate either)
|
||||
// Turn them into default foreground
|
||||
|
||||
@@ -105,4 +105,13 @@ suite('StackTraceHelper', () => {
|
||||
formattedLines.slice(1).forEach(line => assert.ok(!/<a href=.*>/.test(line), 'line should not contain a link: ' + line));
|
||||
});
|
||||
|
||||
test('background (40-49) ANSI colors are removed', () => {
|
||||
const stack =
|
||||
'open\u001b[39;49m\u001b[43m(\u001b[49m\u001b[33;43m\'\u001b[39;49m\u001b[33;43minput.txt\u001b[39;49m\u001b[33;43m\'\u001b[39;49m\u001b[43m)\u001b[49m;';
|
||||
|
||||
const formattedLines = formatStackTrace(stack).formattedStack.split('\n');
|
||||
assert.ok(!/4\d/.test(formattedLines[0]), 'should not contain background colors ' + formattedLines[0]);
|
||||
formattedLines.slice(1).forEach(line => assert.ok(!/<a href=.*>/.test(line), 'line should not contain a link: ' + line));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user