Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(shared): underline styles and colours no longer scramble command output colours #21542

MergedMarcoDotIO(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/21542/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 82 additions and 7 deletions.

x
0 of 2 viewed, 2 left
44 additions and 0 deletionspackages/shared/src/terminalOutput.test.tsModified
View file
@@ -87,6 +87,50 @@
});
​
describe("appendTerminalOutput edge cases from review", () => {
+ const boldRed = { color: TERMINAL_PALETTES.dark[1], fontWeight: "600" } as const;
+ it.each([
+ [
+ "a curly underline",
+ "\u001b[1;31m\u001b[4:3mX",
+ { ...boldRed, textDecorationLine: "underline" },
+ ],
+ ["underline off in colon form", "\u001b[1;31m\u001b[4:0mX", boldRed],
+ ["a true-colour underline colour", "\u001b[1;31m\u001b[58;2;255;0;0mX", boldRed],
+ ["a 256-colour underline colour", "\u001b[58;5;31mX", null],
+ [
+ "a colon-form underline colour",
+ "\u001b[4m\u001b[58:2::255:0:0mX",
+ { textDecorationLine: "underline" },
+ ],
+ ["extra fields in a colon-form indexed underline colour", "\u001b[58:5:0:32mX", null],
+ [
+ "extra fields in a colon-form indexed colour",
+ "\u001b[38:5:1:4mX",
+ { color: TERMINAL_PALETTES.dark[1] },
+ ],
+ [
+ "a true colour with its fields after colons",
+ "\u001b[38;2:255:0:0;1mX",
+ { color: "rgb(255,0,0)", fontWeight: "600" },
+ ],