From f2c3f6f067e7b0853205c46a17c767e21586f12d Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Sat, 31 Jan 2026 09:05:33 -0500 Subject: [PATCH] Avoid stray control characters --- src/ansi.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ansi.ts b/src/ansi.ts index ce2260e..58e6d5c 100644 --- a/src/ansi.ts +++ b/src/ansi.ts @@ -274,6 +274,12 @@ export function ansiToHtml(text: string): string { continue; } + // Backspace: drop it to avoid stray control characters in HTML output + if (text[i] === "\b") { + i++; + continue; + } + // Track newlines and carriage returns if (text[i] === "\n") { // Close span before newline to prevent background color bleeding