Versions 73 to 74
new file, 47 lines
7+
9+export function colorsPass(stream: { isTTY?: boolean }, env: Readonly<Record<string, string | undefined>>): boolean {
12+
13+/** The length of the SGR sequence (ESC [ digits ; : m) starting at i, or 0 when there isn't one. */
23+
24+/** Whether a character code is one the terminal acts on: C0 but tab and newline, DEL, and C1. */
25+const control = (c: number) => (c < 0x20 && c !== 0x09 && c !== 0x0a) || (c >= 0x7f && c <= 0x9f);
26+
27+/** `text` as it is safe to print: colors kept only when `colors`, every other control character shown as text. */
44+ else out += c < 0x80 ? `\\x${c.toString(16).padStart(2, "0")}` : `\\u${c.toString(16).padStart(4, "0")}`;
- MCP
- compare on this site's /mcp
- CLI
- abso diff 73 74 client/src/terminal-text.ts --json
- JSON
- /christopher/abso-core/compare/73..74?file=client%2Fsrc%2Fterminal-text.ts&format=json