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