CellAnchor class

A handle to a cell in a BufferLine that can be used to track the location of the cell. Anchors are guaranteed to be stable, retaining their relative position to each other after mutations to the buffer.

Anchors created by Buffer.createAnchor (or BufferLine.createAnchor on a line read from a terminal) are tracked by libghostty-vt: they follow their cell through scrolling and reflow, and are no longer attached once the cell leaves the scrollback. They hold native memory: dispose them when done (disposing the terminal frees them).

Constructors

CellAnchor(int offset, {BufferLine? owner})
Creates an anchor at cell offset of owner.

Properties

attached → bool
Whether the anchor still points at a cell of a buffer.
no setter
hashCode → int
The hash code for this object.
no setterinherited
line → BufferLine?
The line the anchored cell is on.
no setter
offset → CellOffset
The position of the anchored cell. Only valid while attached.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
x → int
The column of the anchored cell.
no setter
y → int
The buffer row of the anchored cell (0 is the oldest scrollback line). Only valid while attached.
no setter

Methods

dispose() → void
Detaches the anchor from its line (and frees its tracking, if any).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reparent(BufferLine owner, int offset) → void
Moves the anchor to cell offset of owner.
reposition(int offset) → void
Moves the anchor to cell offset of its line.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited