/** * Screen buffer with diff-based rendering * Only writes changes to terminal - minimizes flickering */ export interface Cell { char: string; style: string; } export declare class Screen { private width; private height; private buffer; private rendered; private cursorX; private cursorY; private cursorVisible; private resizeCallback; private readonly resizeHandler; constructor(); /** * Register a callback to be called on terminal resize */ onResize(callback: () => void): void; private createEmptyBuffer; /** * Get terminal dimensions */ getSize(): { width: number; height: number; }; /** * Clear the buffer */ clear(): void; /** * Write text at position */ write(x: number, y: number, text: string, textStyle?: string): void; /** * Write a line, clearing rest of line */ writeLine(y: number, text: string, textStyle?: string): void; /** * Write raw line with pre-formatted ANSI codes (for syntax highlighted content) * This writes directly without parsing for styles since the text already contains ANSI escapes */ writeRaw(y: number, text: string, prefixStyle?: string): void; /** * Write multiple lines starting at y */ writeLines(startY: number, lines: string[], textStyle?: string): number; /** * Write text with word wrapping */ writeWrapped(x: number, y: number, text: string, maxWidth: number, textStyle?: string): number; /** * Draw a horizontal line */ horizontalLine(y: number, char?: string, textStyle?: string): void; /** * Set cursor position for input */ setCursor(x: number, y: number): void; /** * Show/hide cursor */ showCursor(visible: boolean): void; /** * Render only changed cells (diff render) */ render(): void; /** * Full render (no diff, redraw everything) */ /** * Force the next `render()` to repaint every cell. * * The differential renderer skips a cell whose buffer value already matches * the shadow copy — correct only while nothing else writes to the terminal. * The inline overlays (session picker, confirm prompt) draw below the managed * area and scroll it, after which the shadow no longer describes what is on * screen and stale glyphs survive: most visibly a leftover character in * column 0 of the header, which the header never overwrites because it starts * at x = 1. Resizing already recovered by rebuilding both buffers; this is the * same recovery without making the user resize the window. */ invalidate(): void; fullRender(): void; /** * Initialize screen (hide cursor, clear) */ init(): void; /** * Cleanup (show cursor, clear) */ cleanup(): void; }