Terminal
Host operations keep their return convention across execution actors.
Type Parameters
Section titled “Type Parameters”Mode extends "sync" | "async" = "sync"
Implements
Section titled “Implements”TerminalApi<Mode>
Accessors
Section titled “Accessors”appearance
Section titled “appearance”Get Signature
Section titled “Get Signature”get appearance():
TerminalAppearance
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”canvas
Section titled “canvas”Get Signature
Section titled “Get Signature”get canvas():
HTMLCanvasElement|undefined
Returns
Section titled “Returns”HTMLCanvasElement | undefined
Implementation of
Section titled “Implementation of”diagnostics
Section titled “diagnostics”Get Signature
Section titled “Get Signature”get diagnostics():
GhosttyWebGpuTerminalDiagnostics
Returns
Section titled “Returns”GhosttyWebGpuTerminalDiagnostics
Implementation of
Section titled “Implementation of”element
Section titled “element”Get Signature
Section titled “Get Signature”get element():
HTMLDivElement|undefined
Returns
Section titled “Returns”HTMLDivElement | undefined
Implementation of
Section titled “Implementation of”hasPendingFrame
Section titled “hasPendingFrame”Get Signature
Section titled “Get Signature”get hasPendingFrame():
boolean
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”hasPendingLinkResolution
Section titled “hasPendingLinkResolution”Get Signature
Section titled “Get Signature”get hasPendingLinkResolution():
boolean
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”TerminalApi.hasPendingLinkResolution
hasPendingTimer
Section titled “hasPendingTimer”Get Signature
Section titled “Get Signature”get hasPendingTimer():
boolean
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”inputModes
Section titled “inputModes”Get Signature
Section titled “Get Signature”get inputModes():
TerminalInputModes
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”lifecycle
Section titled “lifecycle”Get Signature
Section titled “Get Signature”get lifecycle():
GhosttyWebGpuTerminalLifecycle
Returns
Section titled “Returns”GhosttyWebGpuTerminalLifecycle
Implementation of
Section titled “Implementation of”submittedFrame
Section titled “submittedFrame”Get Signature
Section titled “Get Signature”get submittedFrame():
TerminalSubmittedFrame|undefined
Returns
Section titled “Returns”TerminalSubmittedFrame | undefined
Implementation of
Section titled “Implementation of”textarea
Section titled “textarea”Get Signature
Section titled “Get Signature”get textarea():
HTMLTextAreaElement|undefined
Returns
Section titled “Returns”HTMLTextAreaElement | undefined
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”attachOutputPort()
Section titled “attachOutputPort()”attachOutputPort(
port):Promise<void>
Parameters
Section titled “Parameters”MessagePort
Returns
Section titled “Returns”Promise<void>
blur()
Section titled “blur()”blur():
void
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”captureViewport()
Section titled “captureViewport()”captureViewport():
TerminalResult<Mode,string|undefined>
Returns
Section titled “Returns”TerminalResult<Mode, string | undefined>
Implementation of
Section titled “Implementation of”clearSelection()
Section titled “clearSelection()”clearSelection():
TerminalResult<Mode,boolean>
Returns
Section titled “Returns”TerminalResult<Mode, boolean>
Implementation of
Section titled “Implementation of”clearTextureAtlas()
Section titled “clearTextureAtlas()”clearTextureAtlas():
TerminalResult<Mode,void>
Returns
Section titled “Returns”TerminalResult<Mode, void>
Implementation of
Section titled “Implementation of”connectInput()
Section titled “connectInput()”connectInput(
handler):TerminalResult<Mode,TerminalInputConnection>
Parameters
Section titled “Parameters”handler
Section titled “handler”Returns
Section titled “Returns”TerminalResult<Mode, TerminalInputConnection>
Implementation of
Section titled “Implementation of”dispose()
Section titled “dispose()”dispose():
TerminalResult<Mode,void>
Returns
Section titled “Returns”TerminalResult<Mode, void>
Implementation of
Section titled “Implementation of”fenceOutput()
Section titled “fenceOutput()”fenceOutput(
sequence):Promise<void>
Parameters
Section titled “Parameters”sequence
Section titled “sequence”number
Returns
Section titled “Returns”Promise<void>
focus()
Section titled “focus()”focus():
void
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”focusNextLink()
Section titled “focusNextLink()”focusNextLink():
Promise<boolean>
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”frameSnapshot()
Section titled “frameSnapshot()”frameSnapshot():
TerminalResult<Mode,RendererFrameSnapshot|undefined>
Returns
Section titled “Returns”TerminalResult<Mode, RendererFrameSnapshot | undefined>
Implementation of
Section titled “Implementation of”geometry()
Section titled “geometry()”geometry():
TerminalResult<Mode,TerminalGeometry>
Returns
Section titled “Returns”TerminalResult<Mode, TerminalGeometry>
Implementation of
Section titled “Implementation of”getSelection()
Section titled “getSelection()”getSelection(
options?):TerminalResult<Mode,string|undefined>
Parameters
Section titled “Parameters”options?
Section titled “options?”TerminalSelectionFormatOptions
Returns
Section titled “Returns”TerminalResult<Mode, string | undefined>
Implementation of
Section titled “Implementation of”key(
input):TerminalResult<Mode,TerminalInputResult>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TerminalResult<Mode, TerminalInputResult>
Implementation of
Section titled “Implementation of”lineCount()
Section titled “lineCount()”lineCount():
TerminalResult<Mode,number>
Count retained scrollback and visible rows on the active screen.
Returns
Section titled “Returns”TerminalResult<Mode, number>
Implementation of
Section titled “Implementation of”measure()
Section titled “measure()”measure(
text):TerminalResult<Mode,number>
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”TerminalResult<Mode, number>
Implementation of
Section titled “Implementation of”measureTexts()
Section titled “measureTexts()”measureTexts(
texts):TerminalResult<Mode,TerminalTextMeasurement>
Parameters
Section titled “Parameters”readonly string[]
Returns
Section titled “Returns”TerminalResult<Mode, TerminalTextMeasurement>
Implementation of
Section titled “Implementation of”on<
TType>(type,listener):EventSubscription
Type Parameters
Section titled “Type Parameters”TType extends keyof GhosttyWebGpuTerminalEventMap
Parameters
Section titled “Parameters”TType
listener
Section titled “listener”GhosttyWebGpuTerminalListener<TType>
Returns
Section titled “Returns”EventSubscription
Implementation of
Section titled “Implementation of”onData()
Section titled “onData()”onData(
listener):EventSubscription
Parameters
Section titled “Parameters”listener
Section titled “listener”GhosttyWebGpuTerminalListener<"data">
Returns
Section titled “Returns”EventSubscription
Implementation of
Section titled “Implementation of”onFrame()
Section titled “onFrame()”onFrame(
listener):EventSubscription
Parameters
Section titled “Parameters”listener
Section titled “listener”GhosttyWebGpuTerminalListener<"frame">
Returns
Section titled “Returns”EventSubscription
Implementation of
Section titled “Implementation of”onResize()
Section titled “onResize()”onResize(
listener):EventSubscription
Parameters
Section titled “Parameters”listener
Section titled “listener”GhosttyWebGpuTerminalListener<"resize">
Returns
Section titled “Returns”EventSubscription
Implementation of
Section titled “Implementation of”onText()
Section titled “onText()”onText(
listener):EventSubscription
Parameters
Section titled “Parameters”listener
Section titled “listener”(text) => void
Returns
Section titled “Returns”EventSubscription
Implementation of
Section titled “Implementation of”open()
Section titled “open()”open(
parent):Promise<void>
Parameters
Section titled “Parameters”parent
Section titled “parent”HTMLElement
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”paste()
Section titled “paste()”paste(
data):TerminalResult<Mode,TerminalInputResult>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TerminalResult<Mode, TerminalInputResult>
Implementation of
Section titled “Implementation of”readLines()
Section titled “readLines()”readLines(
start,end,options?):TerminalResult<Mode, readonlyTerminalLine[]>
Read clamped, oldest-first active-screen rows [start, end), capped at TERMINAL_READ_LINES_MAX_ROWS. trimRight defaults to true. Upstream has no inactive-screen selector.
Parameters
Section titled “Parameters”number
number
options?
Section titled “options?”Returns
Section titled “Returns”TerminalResult<Mode, readonly TerminalLine[]>
Implementation of
Section titled “Implementation of”refresh()
Section titled “refresh()”refresh(
startRow,endRow):TerminalResult<Mode,void>
Parameters
Section titled “Parameters”startRow
Section titled “startRow”number
endRow
Section titled “endRow”number
Returns
Section titled “Returns”TerminalResult<Mode, void>
Implementation of
Section titled “Implementation of”registerLinkProvider()
Section titled “registerLinkProvider()”registerLinkProvider(
provider):LinkProviderRegistration
Parameters
Section titled “Parameters”provider
Section titled “provider”LinkProvider<Event>
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”TerminalApi.registerLinkProvider
reset()
Section titled “reset()”reset():
TerminalResult<Mode,TerminalMutationResult>
Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”scrollBy()
Section titled “scrollBy()”scrollBy(
delta):TerminalResult<Mode,TerminalMutationResult>
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”scrollToBottom()
Section titled “scrollToBottom()”scrollToBottom():
TerminalResult<Mode,TerminalMutationResult>
Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”scrollToRow()
Section titled “scrollToRow()”scrollToRow(
row):TerminalResult<Mode,TerminalMutationResult>
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”scrollToTop()
Section titled “scrollToTop()”scrollToTop():
TerminalResult<Mode,TerminalMutationResult>
Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”selectAll()
Section titled “selectAll()”selectAll():
TerminalResult<Mode,boolean>
Returns
Section titled “Returns”TerminalResult<Mode, boolean>
Implementation of
Section titled “Implementation of”selectionCoordinates()
Section titled “selectionCoordinates()”selectionCoordinates():
TerminalResult<Mode,Readonly<SelectionCoordinates> |undefined>
Returns
Section titled “Returns”TerminalResult<Mode, Readonly<SelectionCoordinates> | undefined>
Implementation of
Section titled “Implementation of”TerminalApi.selectionCoordinates
selectLines()
Section titled “selectLines()”selectLines(
startRow,endRow):TerminalResult<Mode,boolean>
Parameters
Section titled “Parameters”startRow
Section titled “startRow”number
endRow
Section titled “endRow”number
Returns
Section titled “Returns”TerminalResult<Mode, boolean>
Implementation of
Section titled “Implementation of”selectRange()
Section titled “selectRange()”selectRange(
start,end):TerminalResult<Mode,boolean>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TerminalResult<Mode, boolean>
Implementation of
Section titled “Implementation of”sendGeneratedInput()
Section titled “sendGeneratedInput()”sendGeneratedInput(
input):TerminalResult<Mode,TerminalInputResult>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TerminalResult<Mode, TerminalInputResult>
Implementation of
Section titled “Implementation of”TerminalApi.sendGeneratedInput
sendInput()
Section titled “sendInput()”sendInput(
data):TerminalResult<Mode,TerminalInputResult>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TerminalResult<Mode, TerminalInputResult>
Implementation of
Section titled “Implementation of”setAccessibilityEnabled()
Section titled “setAccessibilityEnabled()”setAccessibilityEnabled(
enabled):boolean
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”TerminalApi.setAccessibilityEnabled
setAppearance()
Section titled “setAppearance()”setAppearance(
options):TerminalResult<Mode,TerminalMutationResult>
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”setColorScheme()
Section titled “setColorScheme()”setColorScheme(
colorScheme):TerminalResult<Mode,TerminalMutationResult>
Parameters
Section titled “Parameters”colorScheme
Section titled “colorScheme”Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”setCursor()
Section titled “setCursor()”setCursor(
cursor):TerminalResult<Mode,TerminalMutationResult>
Parameters
Section titled “Parameters”cursor
Section titled “cursor”Partial<TerminalCursorSettings>
Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”setCursorInactiveStyle()
Section titled “setCursorInactiveStyle()”setCursorInactiveStyle(
style):TerminalResult<Mode,boolean>
Parameters
Section titled “Parameters”InactiveCursorStyle | undefined
Returns
Section titled “Returns”TerminalResult<Mode, boolean>
Implementation of
Section titled “Implementation of”TerminalApi.setCursorInactiveStyle
setFont()
Section titled “setFont()”setFont(
font):TerminalResult<Mode,TerminalMutationResult>
Parameters
Section titled “Parameters”Partial<TerminalFontSettings>
Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”setTheme()
Section titled “setTheme()”setTheme(
theme):TerminalResult<Mode,TerminalMutationResult>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”use<
Api>(extension):TerminalResult<Mode,ExtensionHandle<Api>>
Type Parameters
Section titled “Type Parameters”Api = void
Parameters
Section titled “Parameters”extension
Section titled “extension”Extension<Api>
Returns
Section titled “Returns”TerminalResult<Mode, ExtensionHandle<Api>>
Implementation of
Section titled “Implementation of”visibleLines()
Section titled “visibleLines()”visibleLines(): readonly
string[]
Returns
Section titled “Returns”readonly string[]
Implementation of
Section titled “Implementation of”write()
Section titled “write()”write(
data):TerminalResult<Mode,TerminalMutationResult>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”writeAndReadGeometry()
Section titled “writeAndReadGeometry()”writeAndReadGeometry(
data):TerminalResult<Mode,TerminalGeometry>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TerminalResult<Mode, TerminalGeometry>
Implementation of
Section titled “Implementation of”TerminalApi.writeAndReadGeometry
writeln()
Section titled “writeln()”writeln(
data):TerminalResult<Mode,TerminalMutationResult>
Parameters
Section titled “Parameters”Returns
Section titled “Returns”TerminalResult<Mode, TerminalMutationResult>
Implementation of
Section titled “Implementation of”[createFromSessionInternal]()
Section titled “[createFromSessionInternal]()”
static[createFromSessionInternal](session,options?):Terminal
Parameters
Section titled “Parameters”session
Section titled “session”TerminalSession<Event>
options?
Section titled “options?”GhosttyWebGpuTerminalFromSessionOptions
Returns
Section titled “Returns”Terminal
create()
Section titled “create()”
staticcreate(options?):Promise<Terminal<"sync">>
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Promise<Terminal<"sync">>
fromWorker()
Section titled “fromWorker()”
staticfromWorker(execution,options):Terminal<"async">
Parameters
Section titled “Parameters”execution
Section titled “execution”WorkerTerminalExecution
options
Section titled “options”GhosttyWebGpuTerminalFromSessionOptions
Returns
Section titled “Returns”Terminal<"async">