loom & weft
Made for Swift.

Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.

LOOM Unreleased (PR #2) / RENDERING AND LAYOUT

CellDiff

Stateful ANSI encoder that retains physical occupancy across skipped logical frames. .skip reserves existing complete glyph footprints, .alwaysUpdate repaints unchanged glyphs, and forced widths remain explicit. Full-screen ED2 is avoided while cells are skipped; explicit clears, viewport moves, and scrollback insertions still affect owned terminal areas. Ordinary Unicode geometry is unchanged.

Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.

Example

var encoder = CellDiff(hyperlinks: true)
let next = Buffer(width: 80, height: 24)
let (bytes, stats) = encoder.encode(next, previous: nil, cursor: nil)
_ = (bytes, stats)
Members on this page

Feature guides and release status

CellDiff

Structure
struct CellDiff

Stateful output encoder.

Unchanged frames (including cursor state) emit no bytes.

Source · CellDiff.swift:7

synchronizedOutput

Instance Property
var synchronizedOutput: Bool

Whether writes are enclosed in synchronized-output escape sequences.

Source · CellDiff.swift:8

colorDepth

Instance Property
var colorDepth: TerminalColorDepth

Expected terminal color encoding.

Source · CellDiff.swift:9

reset()

Instance Method
mutating func reset()

Discards remembered cursor and presentation assumptions. Resynchronize using an appropriate previous frame and clear ownership after outside output.

Source · CellDiff.swift:26

encode(_:previous:cursor:origin:clearScreen:)

Instance Method
mutating func encode(_ next: Buffer, previous: Buffer?, cursor: Point?, origin: Point = Point(x: 0, y: 0), clearScreen: Bool = true) -> (Data, RenderStats)

Encodes local cells at a physical origin.

Disable clearScreen for bounded regions.

A bounded full repaint writes default blanks explicitly and never emits ED 2.

Parameters (5)
next
Next logical cell buffer.
previous
Previously presented cell buffer, or nil for a full repaint.
cursor
Requested display cursor; nil hides it.
origin
Argument type and any default are shown in the declaration; see the behavior notes above.
clearScreen
Argument type and any default are shown in the declaration; see the behavior notes above.

Returns (Data, RenderStats).

Source · CellDiff.swift:37