loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / RENDERING AND LAYOUT

CellDiff

Stateful ANSI encoder used by ANSIRenderBackend. It produces Data and RenderStats without writing. Retain the encoder across frames; pass the previous logical buffer and configure physical origin/clear ownership. Bounded rendering does not clear the whole screen. Hyperlinks are opt-in HTTP(S) destinations with a host, no controls, and at most 2,048 UTF-8 bytes.

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:22

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:31