diff --git a/docs/process-capture.md b/docs/process-capture.md index c315e3e9e..2fa952e76 100644 --- a/docs/process-capture.md +++ b/docs/process-capture.md @@ -110,11 +110,13 @@ while comparisons and trace assertions use the normalized text. Retaining the original adds at most `limits.output_bytes` of text, because it comes from the same admitted PTY chunks rather than a second unbounded stream. -Rendered frame `lines` hold the visible rows after normalization, without -trailing spaces; pad a line to the frame's `columns` to restore the fixed-width -row. `serialized_state` keeps the exact terminal state. Captures commit this -line format in their comparison contract, so a capture whose lines were padded -to full width does not compare as the same contract. +Rendered frame `lines` hold the normalized visible rows with trailing U+0020 +spaces removed. `columns` records the original terminal geometry. Normalization +can change text length, so restoring an earlier normalized row's padding requires +information beyond `columns`. `serialized_state` retains the normalized terminal +serialization. Captures commit this line format in their comparison contract, so +a capture whose lines were padded to full width does not compare as the same +contract. Port normalization recognizes explicit `port`, `tcp_port`, `udp_port`, and `listen` fields, URL authorities, IP endpoints, and `localhost` endpoints, with diff --git a/src/process/capture/TerminalRenderer.test.ts b/src/process/capture/TerminalRenderer.test.ts index e5a19996b..744844b24 100644 --- a/src/process/capture/TerminalRenderer.test.ts +++ b/src/process/capture/TerminalRenderer.test.ts @@ -26,7 +26,7 @@ it("omits trailing blank cells from visible lines without losing rows", async () ); const [frame] = frames; expect(frame?.lines).toEqual(["left right", "", " indented", ""]); - // Fixed-width rows remain recoverable from the recorded column count. + // These plain rows use identity normalization and can be padded for display. expect(frame?.lines.map((line) => line.padEnd(frame.columns, " "))).toEqual([ "left right ", " ".repeat(20), diff --git a/src/process/capture/TerminalRenderer.ts b/src/process/capture/TerminalRenderer.ts index 4322e2781..f818ce4ec 100644 --- a/src/process/capture/TerminalRenderer.ts +++ b/src/process/capture/TerminalRenderer.ts @@ -108,8 +108,8 @@ export class TerminalRenderer { const lines: string[] = []; for (let row = 0; row < this.#terminal.rows; row += 1) { const line = buffer.getLine(buffer.viewportY + row); - // Trailing blank cells carry no information beyond `columns`; dropping - // them keeps sparse screens from costing a full row per blank line. + // Keep normalized display text compact. It can differ in length from the + // original terminal geometry recorded by `columns`. lines.push( this.options .normalize(