Skip to content

Class: VtScreen

@termwright/driver/experimental


@termwright/driver/experimental / VtScreen

Defined in: vt.ts:160

A headless terminal with a serialized write queue and a monotonically increasing screen revision. One instance per session.

new VtScreen(options): VtScreen

Defined in: vt.ts:206

VtOptions

VtScreen

readonly profile: TerminalProfile

Defined in: vt.ts:163

The profile this emulator counts characters with.


readonly terminal: Terminal

Defined in: vt.ts:161

get columns(): number

Defined in: vt.ts:261

number


get hasPendingWrite(): boolean

Defined in: vt.ts:242

True from enqueue until the callback of the final queued VT write.

boolean


get isCaughtUp(): boolean

Defined in: vt.ts:247

Whether every VT write enqueued so far has reached its parse callback.

boolean


get retainedFloor(): number

Defined in: vt.ts:257

Number of scrollback lines evicted since the session started.

number


get revision(): number

Defined in: vt.ts:237

Current screen revision; incremented once per observable VT state change.

number


get rows(): number

Defined in: vt.ts:265

number


get title(): string

Defined in: vt.ts:252

Window title as last set by OSC 0/2.

string

activeBuffer(): "normal" | "alternate"

Defined in: vt.ts:372

Which xterm buffer currently backs the visible viewport.

"normal" | "alternate"


allLines(): string[]

Defined in: vt.ts:315

Every retained line, scrollback first, as text.

string[]


cursor(): CursorInfo

Defined in: vt.ts:361

Cursor position (viewport-relative), visibility and shape.

CursorInfo


dispose(): void

Defined in: vt.ts:471

void


drain(): Promise<void>

Defined in: vt.ts:310

Resolves once every write issued so far has been parsed. A child’s dying output — a stack trace, a panic — is usually still in flight when the pty reports the exit, so anything that reads the screen at that moment must drain first or it reads a screen from before the crash.

Promise<void>


modes(): TerminalModes

Defined in: vt.ts:342

Input-relevant modes, merged from Terminal.modes and our own tracking.

Input modes read 'unknown' only when an embedding explicitly declares them unobservable. Reporting a definite value in that case would be a claim the transport cannot support, so mode-gated actions fail closed.

The pinned passthrough ConPTY carries the same DECSET stream as POSIX PTYs, including mouse, focus, bracketed-paste and alternate-screen modes.

TerminalModes


onMarker(cb): Unsubscribe

Defined in: vt.ts:455

(marker) => void

Unsubscribe


onResponse(cb): Unsubscribe

Defined in: vt.ts:466

Receives terminal protocol replies which the session must return to the child.

(response) => void

Unsubscribe


onRevision(cb): Unsubscribe

Defined in: vt.ts:398

(revision) => void

Unsubscribe


onTitle(cb): Unsubscribe

Defined in: vt.ts:460

(title) => void

Unsubscribe


regionChangeSince(revision, spans): RegionChange

Defined in: vt.ts:427

Why a region is not usable at a past revision, or that it is.

The three answers call for different work and are indistinguishable from the boolean. A coordinate system that moved invalidates every region at once and says nothing about the target; cells that changed say the target itself is different; a span outside the grid is a caller error. A stale pointer that reports only “changed” sends the reader looking in the wrong place, which on Windows it has.

number

readonly object[]

RegionChange


regionUnchangedSince(revision, spans): boolean

Defined in: vt.ts:410

Whether every cell in spans survived unchanged since revision. Returns false when a resize/buffer/scroll changed the coordinate system. This is the target-local counterpart of global waitForQuiet(): an unrelated status bar may animate without invalidating a button elsewhere on screen.

number

readonly object[]

boolean


resize(columns, rows): void

Defined in: vt.ts:325

Resizes the emulator grid (the PTY is resized separately by the session).

number

number

void


serializeAnsi(scrollback?): string

Defined in: vt.ts:389

ANSI serialization of the visible grid (addon-serialize).

number = 0

string


serializeHtml(scrollback?): string

Defined in: vt.ts:394

HTML serialization of the visible grid (addon-serialize).

number = 0

string


shellIntegration(): ShellIntegration

Defined in: vt.ts:377

Prompt state as reported by OSC 133, if the program reports it at all.

ShellIntegration


write(data): Promise<void>

Defined in: vt.ts:273

Feeds bytes to the emulator and resolves once they have been parsed and the resulting revision published. Writes are serialized in call order.

string | Uint8Array<ArrayBufferLike>

Promise<void>