Documentation
¶
Overview ¶
Package vt binds libghostty-vt, the terminal emulator of Ghostty, which it loads at run time through purego: no cgo. It mirrors the structs of the C API it passes, checks them against the layouts the library describes (ghostty_type_json) as it loads, and reads packed cells by the bit positions the library reports, so that a library of another version fails to load instead of corrupting memory.
Nothing here is safe for concurrent use: callers serialize the calls on a Terminal and on what is made from it.
Index ¶
- Constants
- func EncodeFocus(gained bool) []byte
- func EncodePaste(text string, bracketed bool) []byte
- func Load(path string) error
- func Loaded() bool
- func PasteIsSafe(text string) bool
- type Cell
- type ClipboardAnswer
- type ClipboardRead
- type ClipboardReply
- type Color
- type Colors
- type Cursor
- type CursorStyle
- type DeferredClipboardRead
- type Dirty
- type Effects
- type Geometry
- type Gesture
- func (g *Gesture) Autoscroll(t *Terminal) int
- func (g *Gesture) Drag(t *Terminal, ref GridRef, x, y float64, geo Geometry, rect bool) (Selection, bool)
- func (g *Gesture) Dragged(t *Terminal) bool
- func (g *Gesture) Free(t *Terminal)
- func (g *Gesture) Press(t *Terminal, ref GridRef, x, y float64, ns uint64) (Selection, bool)
- func (g *Gesture) Release(t *Terminal, ref *GridRef)
- func (g *Gesture) Reset(t *Terminal)
- func (g *Gesture) Tick(t *Terminal, col, row int, x, y float64, geo Geometry, rect bool) (Selection, bool)
- type GridRef
- type Key
- type KeyAction
- type KeyEncoder
- type KeyEvent
- type Mode
- type Mods
- type MouseAction
- type MouseEncoder
- type RGB
- type RenderState
- func (r *RenderState) BeginUpdate(t *Terminal) error
- func (r *RenderState) CellGraphemes(x int, buf []rune) []rune
- func (r *RenderState) CellStyle(x int) Style
- func (r *RenderState) Clean()
- func (r *RenderState) Colors() Colors
- func (r *RenderState) Cursor() Cursor
- func (r *RenderState) Dirty() Dirty
- func (r *RenderState) EndUpdate()
- func (r *RenderState) Free()
- func (r *RenderState) NextRow() bool
- func (r *RenderState) RowCells() []Cell
- func (r *RenderState) RowDirty() bool
- func (r *RenderState) RowID() RowID
- func (r *RenderState) RowSelection() (start, end int, ok bool)
- func (r *RenderState) RowWrapped() bool
- func (r *RenderState) Rows()
- func (r *RenderState) Size() (cols, rows int)
- func (r *RenderState) Update(t *Terminal) error
- type Result
- type RowID
- type Scrollbar
- type Selection
- type Style
- type Terminal
- func (t *Terminal) Activity() uint64
- func (t *Terminal) AltScreen() bool
- func (t *Terminal) AnswerClipboard(d *DeferredClipboardRead, allowed bool, contents map[string][]byte, ...)
- func (t *Terminal) AtBottom() bool
- func (t *Terminal) CellAt(x, y int) (GridRef, bool)
- func (t *Terminal) Compress() bool
- func (t *Terminal) Cursor() (x, y int)
- func (t *Terminal) Free()
- func (t *Terminal) Hyperlink(ref GridRef) string
- func (t *Terminal) KittyKeyboardFlags() int
- func (t *Terminal) Mode(m Mode) bool
- func (t *Terminal) ModifyOtherKeys() bool
- func (t *Terminal) MouseShape() int
- func (t *Terminal) MouseTracking() bool
- func (t *Terminal) PasteEvent(mimes []string) bool
- func (t *Terminal) Pwd() string
- func (t *Terminal) Reset()
- func (t *Terminal) Resize(cols, rows, cellWidth, cellHeight int) error
- func (t *Terminal) RowText(y int) (text []rune, cols []int)
- func (t *Terminal) ScrollBy(rows int)
- func (t *Terminal) ScrollToBottom()
- func (t *Terminal) ScrollToRow(row int)
- func (t *Terminal) ScrollToTop()
- func (t *Terminal) ScrollbackRows() int
- func (t *Terminal) Scrollbar() Scrollbar
- func (t *Terminal) SelectAll() (Selection, bool)
- func (t *Terminal) SelectionText() (string, bool)
- func (t *Terminal) SetColors(fg, bg RGB, cursor *RGB, palette *[256]RGB)
- func (t *Terminal) SetDefaultCursor(s CursorStyle, blink bool)
- func (t *Terminal) SetMode(m Mode, v bool)
- func (t *Terminal) SetModeDefault(m Mode, v bool)
- func (t *Terminal) SetResizePullBack(v bool)
- func (t *Terminal) SetScrollback(n int)
- func (t *Terminal) SetSelection(s *Selection)
- func (t *Terminal) SetTerminfoName(name string)
- func (t *Terminal) Size() (cols, rows int)
- func (t *Terminal) Text() string
- func (t *Terminal) Title() string
- func (t *Terminal) VT() []byte
- func (t *Terminal) Write(p []byte)
- type Wide
Constants ¶
const ( ButtonNone = 0 ButtonLeft = 1 ButtonRight = 2 ButtonMiddle = 3 WheelUp = 4 WheelDown = 5 WheelLeft = 6 WheelRight = 7 )
Mouse buttons: 1 left, 2 right, 3 middle, 4 and 5 the wheel up and down, 6 and 7 left and right.
const ( UnderlineNone = iota UnderlineSingle UnderlineDouble UnderlineCurly UnderlineDotted UnderlineDashed )
Underline styles.
const Supported = true
Supported reports whether the platform can load the library.
Variables ¶
This section is empty.
Functions ¶
func EncodeFocus ¶
EncodeFocus returns the report of the terminal gaining or losing the focus (mode 1004).
func EncodePaste ¶
EncodePaste returns text as the program reads a paste: bracketed (mode 2004), or with newlines as carriage returns, and without the control characters that could run commands.
func Load ¶
Load loads the library at path. Only the first call loads one: later calls report how it went, whatever their path.
func PasteIsSafe ¶
PasteIsSafe reports whether pasting text cannot run a command by itself.
Types ¶
type Cell ¶
type Cell struct {
// Codepoint is the character, 0 for none; Grapheme reports more
// codepoints after it (CellGraphemes).
Codepoint rune
Grapheme bool
// Style identifies the cell's style (CellStyle) among the row's
// cells: 0 is the default.
Style uint16
Wide Wide
Hyperlink bool
// Background is the color of a cell without text whose background
// a program filled, when HasBackground; Palette tells that it is
// the palette's color of index Background.R.
Background RGB
HasBackground bool
Palette bool
}
Cell is a cell of a row.
type ClipboardAnswer ¶
type ClipboardAnswer int
ClipboardAnswer is how the ClipboardRead effect answers a program's read of the clipboard.
const ( // ClipboardRefused has the library refuse the read itself: an empty // OSC 52 reply, an EPERM status for the Kitty protocol's OSC 5522, // which the binding drops, as the read of a terminal that is not the // one to answer. It is the zero value. ClipboardRefused ClipboardAnswer = iota // ClipboardAnswered answers the read with ClipboardReply.Contents // now, which the library encodes as it returns. ClipboardAnswered // ClipboardDeferred holds the library's refusal back and answers the // read later with Terminal.AnswerClipboard, which needs a // ClipboardReply carrying a DeferredClipboardRead. ClipboardDeferred )
type ClipboardRead ¶
type ClipboardRead struct {
// Mimes are the types asked for, in order of preference; List asks
// for the types available.
Mimes []string
List bool
// Primary is the selection clipboard of X11.
Primary bool
// Granted tells that the program holds the terminal's permission, as
// when it reads what a paste offered it.
Granted bool
// CanRemember tells that the program asked with a password (the one
// a paste event gave it, with its name): a terminal that pasted
// knows it — Granted says so — and one that does not never can, and
// leaves the read to the one it is for.
CanRemember bool
}
ClipboardRead is a program's request to read the clipboard.
type ClipboardReply ¶
type ClipboardReply struct {
Contents map[string][]byte
Available []string
// Deferred is the read to answer later, with ClipboardDeferred.
Deferred *DeferredClipboardRead
}
ClipboardReply answers a ClipboardRead: Contents by MIME type, of the types asked for, and Available when the list was asked for. Without contents the read is refused. A deferred read carries Deferred instead.
type Color ¶
Color is the color of a style: none (the default), an index of the palette, or an RGB color.
type Colors ¶
type Colors struct {
Background, Foreground RGB
// Cursor is the cursor's color when HasCursor is set; it takes the
// text's otherwise.
Cursor RGB
HasCursor bool
Palette [256]RGB
}
Colors are the colors of a frame: those programs set, else the defaults.
type Cursor ¶
type Cursor struct {
// InView reports that the cursor is in the viewport, at column X of
// row Y; WideTail that it is on the second half of a wide character.
InView bool
X, Y int
WideTail bool
// Visible reports that programs show the cursor, Blinking that it
// blinks, Password that the program reads a password.
Visible, Blinking, Password bool
Style CursorStyle
}
Cursor is the cursor of a frame.
type CursorStyle ¶
type CursorStyle int32
CursorStyle is the shape of the cursor.
const ( CursorBar CursorStyle = iota CursorBlock CursorUnderline CursorBlockHollow )
type DeferredClipboardRead ¶
type DeferredClipboardRead struct {
// contains filtered or unexported fields
}
DeferredClipboardRead is a read the embedder answers after its effect returned (ClipboardDeferred). The binding fills it as the library writes the refusal it holds back: kitty tells that the read came by the Kitty clipboard protocol (OSC 5522) rather than OSC 52; for OSC 52, prefix is the reply's beginning ("\x1b]52;" with the selector and its ";") and terminator how the request ended; refusal is what the library wrote to refuse the read (the empty OSC 52 reply, or the EPERM packet), which a denial writes again; mimes, list and primary are what the program asked for, and id is the id of a Kitty protocol read, echoed in its answer. Pass it to Terminal.AnswerClipboard.
type Effects ¶
type Effects struct {
// WritePTY answers the program, as to a query of the cursor's
// position. p is only valid during the call.
WritePTY func(p []byte)
Bell func()
// TitleChanged and PwdChanged tell that Title or Pwd changed.
TitleChanged func()
PwdChanged func()
// RenderHold tells that the program started or ended a synchronized
// update (mode 2026), during which the screen should not show.
RenderHold func(held bool)
// Clipboard writes text to the clipboard (OSC 52), and reports
// whether it did. primary is the selection clipboard of X11.
Clipboard func(text string, primary bool) bool
// ClipboardRead answers a program's read of the clipboard (OSC 52
// with "?", the Kitty clipboard protocol's OSC 5522): the contents of
// the MIME types asked for, and the types available when the program
// asks for the list. ClipboardAnswered writes the reply, encoded, to
// WritePTY in one call as ClipboardRead returns; ClipboardRefused
// refuses it (an empty OSC 52 reply, EPERM for OSC 5522), and the
// EPERM is dropped, so that a terminal that is not the one to answer
// stays silent; ClipboardDeferred holds the refusal back and answers
// later through Terminal.AnswerClipboard, for a terminal that must
// ask the user first.
ClipboardRead func(req ClipboardRead) (reply ClipboardReply, answer ClipboardAnswer)
// Size reports the size of the screen in cells and of a cell in
// pixels, for size reports.
Size func() (cols, rows, cellWidth, cellHeight int)
// Dark reports whether the colors are dark, for color scheme reports.
Dark func() bool
// Notify shows a desktop notification (OSC 9, OSC 777).
Notify func(title, body string)
// Progress reports the progress of the program (OSC 9;4): state is
// 0 to remove it, 1 to set it to progress (0 to 100), 2 for an error,
// 3 for indeterminate progress and 4 paused.
Progress func(state, progress int)
}
Effects are what a terminal asks of its embedder while it processes output, all optional. They run during Terminal.Write, which they must not call.
type Geometry ¶
type Geometry struct {
Columns, CellWidth, PadLeft, Height int
}
Geometry is the grid in pixels, for drags.
type Gesture ¶
type Gesture struct {
// contains filtered or unexported fields
}
Gesture turns presses and drags of the pointer into selections as Ghostty does: a click and a drag select cells, a double click words and a triple click lines, and dragging past the top or the bottom asks to scroll.
func NewGesture ¶
NewGesture makes a gesture: repeated clicks count within interval nanoseconds of each other and distance pixels.
func (*Gesture) Autoscroll ¶
Autoscroll reports whether a drag past an edge asks to scroll up (-1) or down (1).
func (*Gesture) Drag ¶
func (g *Gesture) Drag(t *Terminal, ref GridRef, x, y float64, geo Geometry, rect bool) (Selection, bool)
Drag moves the pressed pointer to cell ref at x, y pixels, selecting a rectangle when rect is set.
func (*Gesture) Dragged ¶
Dragged reports whether the pointer moved to another cell since it was pressed.
func (*Gesture) Press ¶
Press presses the pointer on cell ref at x, y pixels, at time ns of a monotonic clock. A double or triple click selects at once.
type GridRef ¶
type GridRef struct {
// contains filtered or unexported fields
}
GridRef is a GhosttyGridRef: a cell of the terminal, valid until the terminal next changes.
type Key ¶
type Key int32
Key is a GhosttyKey: a key by its place on the keyboard, as the W3C's KeyboardEvent.code names them.
const ( KeyUnidentified Key = iota KeyBackquote KeyBackslash KeyBracketLeft KeyBracketRight KeyComma KeyDigit0 KeyDigit1 KeyDigit2 KeyDigit3 KeyDigit4 KeyDigit5 KeyDigit6 KeyDigit7 KeyDigit8 KeyDigit9 KeyEqual KeyIntlBackslash KeyIntlRo KeyIntlYen KeyA KeyB KeyC KeyD KeyE KeyF KeyG KeyH KeyI KeyJ KeyK KeyL KeyM KeyN KeyO KeyP KeyQ KeyR KeyS KeyT KeyU KeyV KeyW KeyX KeyY KeyZ KeyMinus KeyPeriod KeyQuote KeySemicolon KeySlash KeyAltLeft KeyAltRight KeyBackspace KeyCapsLock KeyContextMenu KeyControlLeft KeyControlRight KeyEnter KeyMetaLeft KeyMetaRight KeyShiftLeft KeyShiftRight KeySpace KeyTab KeyConvert KeyKanaMode KeyNonConvert KeyDelete KeyEnd KeyHelp KeyHome KeyInsert KeyPageDown KeyPageUp KeyArrowDown KeyArrowLeft KeyArrowRight KeyArrowUp )
Keys, in the order of GhosttyKey.
const ( KeyEscape Key = KeyArrowUp + 1 + 41 + iota KeyF1 )
KeyEscape and the function keys follow the 41 keys of the numpad.
type KeyEncoder ¶
type KeyEncoder struct {
// contains filtered or unexported fields
}
KeyEncoder encodes keys as the terminal's modes ask: legacy sequences, xterm's modifyOtherKeys or the Kitty keyboard protocol.
func (*KeyEncoder) Encode ¶
func (e *KeyEncoder) Encode(k KeyEvent) []byte
Encode returns the bytes the program reads for k, valid until the next call; nil for keys that send nothing.
func (*KeyEncoder) Sync ¶
func (e *KeyEncoder) Sync(t *Terminal, optionAsAlt bool)
Sync takes the terminal's modes, and whether Option is Alt on macOS.
type KeyEvent ¶
type KeyEvent struct {
Action KeyAction
Key Key
Mods Mods
// Consumed are the modifiers that made Text, as Shift an "A".
Consumed Mods
// Text is what the key types, without what Ctrl or Alt change; empty
// for keys that type nothing.
Text string
// Unshifted is the character the key types without modifiers.
Unshifted rune
// Composing tells that an input method is composing.
Composing bool
}
KeyEvent is a key to encode for the program.
type Mode ¶
type Mode uint16
Mode is a GhosttyMode: a DEC private mode, or an ANSI one with bit 15.
const ( ModeCursorKeys Mode = 1 ModeCursorVisible Mode = 25 ModeFocusEvent Mode = 1004 ModeAltScroll Mode = 1007 ModeBracketedPaste Mode = 2004 // ModePasteEvents has a paste tell the program what the clipboard // holds, which it reads itself (the Kitty clipboard protocol). ModePasteEvents Mode = 5522 ModeSyncOutput Mode = 2026 ModeGraphemes Mode = 2027 )
Modes.
type Mods ¶
type Mods uint16
Mods are modifier keys (GhosttyMods): Shift, Ctrl, Alt and Super, the same bits as Golet's.
type MouseAction ¶
type MouseAction int32
MouseAction is what the pointer did.
const ( MousePress MouseAction = iota MouseRelease MouseMotion )
type MouseEncoder ¶
type MouseEncoder struct {
// contains filtered or unexported fields
}
MouseEncoder encodes pointer events in the format and for the events the program asked for.
func NewMouseEncoder ¶
func NewMouseEncoder() (*MouseEncoder, error)
NewMouseEncoder makes a mouse encoder.
func (*MouseEncoder) Encode ¶
func (m *MouseEncoder) Encode(action MouseAction, button int, mods Mods, x, y float32) []byte
Encode returns the bytes the program reads for a pointer event at x, y pixels, valid until the next call; nil when it asked for no such event.
type RenderState ¶
type RenderState struct {
// contains filtered or unexported fields
}
RenderState is a GhosttyRenderState: what a frame draws of a terminal, copied from it by an update, with the rows that changed since the last frame marked dirty.
func NewRenderState ¶
func NewRenderState() (*RenderState, error)
NewRenderState makes an empty render state.
func (*RenderState) BeginUpdate ¶
func (r *RenderState) BeginUpdate(t *Terminal) error
BeginUpdate copies the terminal's state, the only step that needs the terminal; EndUpdate finishes the update without it.
func (*RenderState) CellGraphemes ¶
func (r *RenderState) CellGraphemes(x int, buf []rune) []rune
CellGraphemes appends the codepoints of cell x of the row RowCells read to buf.
func (*RenderState) CellStyle ¶
func (r *RenderState) CellStyle(x int) Style
CellStyle returns the style of cell x of the row RowCells read.
func (*RenderState) Colors ¶
func (r *RenderState) Colors() Colors
Colors returns the colors of the frame.
func (*RenderState) Cursor ¶
func (r *RenderState) Cursor() Cursor
Cursor returns the cursor of the frame.
func (*RenderState) Dirty ¶
func (r *RenderState) Dirty() Dirty
Dirty reports how much changed since the last Clean.
func (*RenderState) EndUpdate ¶
func (r *RenderState) EndUpdate()
EndUpdate finishes the update BeginUpdate started.
func (*RenderState) NextRow ¶
func (r *RenderState) NextRow() bool
NextRow moves to the next row, and reports whether there is one.
func (*RenderState) RowCells ¶
func (r *RenderState) RowCells() []Cell
RowCells returns the cells of the row, valid until the next update.
func (*RenderState) RowDirty ¶
func (r *RenderState) RowDirty() bool
RowDirty reports whether the row changed since the last Clean.
func (*RenderState) RowID ¶
func (r *RenderState) RowID() RowID
RowID returns the identity of the row, which it keeps as it scrolls.
func (*RenderState) RowSelection ¶
func (r *RenderState) RowSelection() (start, end int, ok bool)
RowSelection returns the selected columns of the row, from start to end inclusive.
func (*RenderState) RowWrapped ¶
func (r *RenderState) RowWrapped() bool
RowWrapped reports whether the row soft-wraps into the next.
func (*RenderState) Rows ¶
func (r *RenderState) Rows()
Rows starts going through the rows of the frame, top to bottom, with NextRow.
func (*RenderState) Size ¶
func (r *RenderState) Size() (cols, rows int)
Size returns the size of the viewport in cells.
func (*RenderState) Update ¶
func (r *RenderState) Update(t *Terminal) error
Update updates the render state from the terminal in one step.
type RowID ¶
type RowID struct {
// contains filtered or unexported fields
}
RowID identifies a row across render state updates (a GhosttyRenderStateRowId).
type Scrollbar ¶
type Scrollbar struct {
Total, Offset, Len uint64
}
Scrollbar is a GhosttyTerminalScrollbar: the rows of the screen and its scrollback, the first row of the viewport and how many rows it shows.
type Selection ¶
type Selection struct {
// contains filtered or unexported fields
}
Selection is a GhosttySelection: two cells of the terminal, inclusive, valid until the terminal next changes.
type Style ¶
type Style struct {
FG, BG, UnderlineColor Color
Bold, Italic, Faint, Blink, Inverse, Invisible, Strikethrough, Overline bool
Underline int
}
Style is how a cell's text shows.
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
Terminal is a GhosttyTerminal: the screen, its scrollback, the cursor and the modes, which the output of programs changes.
func NewTerminal ¶
NewTerminal makes a terminal of cols columns and rows rows.
func (*Terminal) AltScreen ¶
AltScreen reports whether the alternate screen shows, as in full-screen programs.
func (*Terminal) AnswerClipboard ¶
func (t *Terminal) AnswerClipboard(d *DeferredClipboardRead, allowed bool, contents map[string][]byte, available []string)
AnswerClipboard answers a read that the ClipboardRead effect deferred (ClipboardDeferred): allowed serves contents by MIME type, and available for the types listing (OSC 5522's "."), while denied writes the refusal the library wrote for the read and the binding held back. It is safe from any goroutine, and contents and available are not retained after it returns.
func (*Terminal) AtBottom ¶
AtBottom reports whether the viewport follows the active screen, rather than showing the scrollback.
func (*Terminal) Compress ¶
Compress compresses some of the scrollback, as when the terminal is idle, and reports whether more is left to compress.
func (*Terminal) Cursor ¶
Cursor returns the cursor's column and row in the active screen, the bottom of the scrollback.
func (*Terminal) KittyKeyboardFlags ¶
KittyKeyboardFlags returns the flags of the kitty keyboard protocol programs set.
func (*Terminal) ModifyOtherKeys ¶
ModifyOtherKeys reports whether xterm's modifyOtherKeys mode 2 is on.
func (*Terminal) MouseShape ¶
MouseShape returns the pointer shape a program asked for (OSC 22), a GhosttyMouseShape.
func (*Terminal) MouseTracking ¶
MouseTracking reports whether a program asked for mouse events.
func (*Terminal) PasteEvent ¶
PasteEvent tells the program what the clipboard offers a paste, by the MIME types, for it to read what it wants (mode 5522, the Kitty clipboard protocol); the program's reads come to Effects.ClipboardRead, granted. The event goes to the program through Effects.WritePTY. It reports whether the event was sent: it is not when the mode is not set or the terminal has no ClipboardRead, when the paste is the embedder's to encode (EncodePaste).
func (*Terminal) Pwd ¶
Pwd returns the working directory the shell reported (OSC 7), as it reported it: a file URL, or a path.
func (*Terminal) RowText ¶
RowText returns the text of row y of the viewport, and the column of each of its runes.
func (*Terminal) ScrollToBottom ¶
func (t *Terminal) ScrollToBottom()
func (*Terminal) ScrollToRow ¶
func (*Terminal) ScrollToTop ¶
func (t *Terminal) ScrollToTop()
ScrollToTop, ScrollToBottom, ScrollBy and ScrollToRow move the viewport: to the top of the scrollback, to the active screen, by rows (negative up), or to show row first.
func (*Terminal) ScrollbackRows ¶
ScrollbackRows returns how many rows the scrollback holds.
func (*Terminal) SelectionText ¶
SelectionText returns the text of the selection, with soft-wrapped lines joined and trailing spaces trimmed, as Ghostty copies it.
func (*Terminal) SetColors ¶
SetColors sets the default colors, which programs may change: the foreground, the background, the cursor's (nil for the text's) and the palette of 256 colors (nil for Ghostty's).
func (*Terminal) SetDefaultCursor ¶
func (t *Terminal) SetDefaultCursor(s CursorStyle, blink bool)
SetDefaultCursor sets the cursor that programs reset to (DECSCUSR 0).
func (*Terminal) SetModeDefault ¶
SetModeDefault sets a mode, and the value a reset restores.
func (*Terminal) SetResizePullBack ¶
SetResizePullBack sets whether growing the screen pulls rows back from the scrollback, which a pseudo-terminal keeping its own screen, as Windows' ConPTY, cannot follow.
func (*Terminal) SetScrollback ¶
SetScrollback limits the scrollback to about n bytes.
func (*Terminal) SetSelection ¶
SetSelection selects s, or nothing when s is nil.
func (*Terminal) SetTerminfoName ¶
SetTerminfoName sets the name of the terminfo entry the terminal reports (XTGETTCAP TN).
func (*Terminal) Text ¶
Text returns the text of the screen and its scrollback, with soft-wrapped lines joined and trailing spaces trimmed.
func (*Terminal) VT ¶
VT returns the terminal's state as escape sequences, which restore it in a terminal of the same size: the scrollback and the screen with their styles and hyperlinks, then the modes, the scrolling region, the tab stops, the working directory, the keyboard's flags and the cursor. The palette is left out, as the terminal it restores in has colors of its own.