Compare commits

...
Author SHA1 Message Date
N0zoM1z0 44f69e655c docs(process): clarify normalized terminal row geometry 2026-10-10 14:37:04 +08:00
3 changed files with 10 additions and 8 deletions
+7 -5
View File
@@ -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 original adds at most `limits.output_bytes` of text, because it comes from the
same admitted PTY chunks rather than a second unbounded stream. same admitted PTY chunks rather than a second unbounded stream.
Rendered frame `lines` hold the visible rows after normalization, without Rendered frame `lines` hold the normalized visible rows with trailing U+0020
trailing spaces; pad a line to the frame's `columns` to restore the fixed-width spaces removed. `columns` records the original terminal geometry. Normalization
row. `serialized_state` keeps the exact terminal state. Captures commit this can change text length, so restoring an earlier normalized row's padding requires
line format in their comparison contract, so a capture whose lines were padded information beyond `columns`. `serialized_state` retains the normalized terminal
to full width does not compare as the same contract. 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 Port normalization recognizes explicit `port`, `tcp_port`, `udp_port`, and
`listen` fields, URL authorities, IP endpoints, and `localhost` endpoints, with `listen` fields, URL authorities, IP endpoints, and `localhost` endpoints, with
+1 -1
View File
@@ -26,7 +26,7 @@ it("omits trailing blank cells from visible lines without losing rows", async ()
); );
const [frame] = frames; const [frame] = frames;
expect(frame?.lines).toEqual(["left right", "", " indented", ""]); 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([ expect(frame?.lines.map((line) => line.padEnd(frame.columns, " "))).toEqual([
"left right ", "left right ",
" ".repeat(20), " ".repeat(20),
+2 -2
View File
@@ -108,8 +108,8 @@ export class TerminalRenderer {
const lines: string[] = []; const lines: string[] = [];
for (let row = 0; row < this.#terminal.rows; row += 1) { for (let row = 0; row < this.#terminal.rows; row += 1) {
const line = buffer.getLine(buffer.viewportY + row); const line = buffer.getLine(buffer.viewportY + row);
// Trailing blank cells carry no information beyond `columns`; dropping // Keep normalized display text compact. It can differ in length from the
// them keeps sparse screens from costing a full row per blank line. // original terminal geometry recorded by `columns`.
lines.push( lines.push(
this.options this.options
.normalize( .normalize(