fix(tui): reset styles per line

This commit is contained in:
Mario Zechner 2026-01-11 18:36:48 +01:00
parent 741262d89d
commit 6d495348c5
5 changed files with 37 additions and 0 deletions

View file

@ -289,6 +289,11 @@ export class TUI extends Container {
private static readonly SEGMENT_RESET = "\x1b[0m\x1b]8;;\x07";
private applyLineResets(lines: string[]): string[] {
const reset = TUI.SEGMENT_RESET;
return lines.map((line) => (this.containsImage(line) ? line : line + reset));
}
/** Splice overlay content into a base line at a specific column. Single-pass optimized. */
private compositeLineAt(
baseLine: string,
@ -343,6 +348,8 @@ export class TUI extends Container {
newLines = this.compositeOverlays(newLines, width, height);
}
newLines = this.applyLineResets(newLines);
// Width changed - need full re-render
const widthChanged = this.previousWidth !== 0 && this.previousWidth !== width;