Skip to content

TextbufferEngine

Text lives only in the piece table. Runs compress implicit right-child chains.

new TextbufferEngine(buffer?): TextbufferEngine

Bootstrap accepts a fresh, identity-enabled snapshot with one contiguous ID run.

PieceTableTreeSnapshot

TextbufferEngine

apply(envelope): void

Applies text edits and atomic effect states, retaining provenance in snapshots.

Envelope

void

Engine.apply


author(edit, context): Envelope

Author against the current projection, reserve IDs once, and leave text unchanged.

OffsetEdit

AuthorContext

Envelope

Engine.author


changesBetween(snapshot): PieceTableEdit[]

TextbufferSnapshot

PieceTableEdit[]

Engine.changesBetween


characters(): readonly CharacterIdentity[]

Diagnostic inventory sorted by bunch/counter; hidden IDs retain their visible gap.

readonly CharacterIdentity[]

Engine.characters


effectActive(id): boolean

EditId

boolean


origins(offset): object

number

object

readonly originLeft: LeftOrigin

readonly originRight: RightOrigin


projectEffects(effects): TextbufferSnapshot

A local review snapshot with selected effect states; the live engine and log stay unchanged.

readonly Effect[]

TextbufferSnapshot

Engine.projectEffects


restore(snapshot): void

TextbufferSnapshot

void

Engine.restore


snapshot(): TextbufferSnapshot

TextbufferSnapshot

Engine.snapshot


text(): string

string

Engine.text


visibleOffset(id): number | null

CharId

number | null