/** * The bounded per-file comparison inspector. * * One file, one surface, opened only by explicit disclosure from the * changed-file list. It asks Harness for that ONE file's comparison on the open * it was given and paints nothing until the answer settles, so a reader who * scrolls the list, opens a different turn, or walks back to the outline pays * for no comparison at all. * * The window is the shared {@link RowViewport} and the frame is the shared * {@link createBoundedSurface}: this file introduces no scrolling engine and no * alternate screen, and the terminal's own scrollback remains the transcript * underneath. Its key set is the same one the turn inspection surface already * offers. There is no `pgup`/`pgdn` because the renderer's `KeyName` has no such * key, and writing a second decoding table here would be the mistake rule 6 of * AGENTS.md exists to prevent. * * Every upstream string is untrusted. `display`, the hunk heading, and each diff * line are file CONTENT — a path or a line may carry an escape, a control * character, a combining mark, or ten thousand columns of text — and each passes * through `escapeControls` before it is measured and again before it is drawn. A * coarse comparison is Harness saying its own line comparison timed out and every * line is shown replaced; that fact is stated, because presenting the result as an * ordinary hunk would claim a precision the recorder did not have. * @module dshline/turns/diff-overlay */ import type { TuiOverlay } from '../slots.ts'; import type { ChangedFileRow } from './changes.ts'; import { type FileDiffRequest } from './file-diff.ts'; /** Inputs the comparison inspector needs from the presenter. */ export interface FileDiffOverlaySpec { /** The file this surface was opened on. */ readonly file: ChangedFileRow; /** * Ask Harness for this one file's comparison. * * Called ONCE per open, by the surface, before the first paint. `signal` is * aborted by {@link close}, so an inspector the reader has already left never * holds a git read open. * @param file - the disclosed file row. * @param signal - cancels the reads. * @returns the comparison, or undefined when Harness can serve none. * @throws whatever a live Session's read threw. */ readonly request: FileDiffRequest; /** Redraw after a read settles or a keystroke moved the window. */ readonly invalidate: () => void; /** Remove this temporary surface. */ readonly close: () => void; } /** * Create the bounded comparison surface. * * The read starts here rather than in the presenter so that closing the surface * and a late settlement arriving are the same code path: {@link close} aborts, * {@link publish} refuses anything that arrives after it, and a surface the * reader has left cannot repaint over the file list underneath it. * @param spec - the disclosed file, the read, and the surface controls. * @returns a live-region overlay that never writes the transcript. */ export declare function createFileDiffOverlay(spec: FileDiffOverlaySpec): TuiOverlay; //# sourceMappingURL=diff-overlay.d.ts.map