TerminalBuffer
Full public contract for the terminal buffer.
Composes all role-specific interfaces into a single surface for host applications and host tests.
Coordinates are always zero-based when they are expressed directly as rows and columns on this API. DEC/ANSI commands that are traditionally 1-based should be translated by the parser before they reach the core.
The parser should depend only on the narrower interfaces it actually needs; this facade mainly exists for host host points and tests.
Properties
Functions
Appends one grapheme-continuation codepoint to the most recently written printable cell without moving the cursor.
Executes a carriage return (CR, 0x0D).
Clears all tab stops (TBC 3, CSI 3 g).
Discards all queued response bytes from this channel.
Clears the visible screen and homes the cursor (equivalent to ED 2 + CUP).
Clears the tab stop at the current cursor column (TBC 0, CSI 0 g).
Moves the cursor backward by count tab stops (CBT, CSI Ps Z).
Moves the cursor down by n rows (CUD, CSI n B).
Advances the cursor forward by count tab stops (CHT, CSI Ps I).
Moves the cursor left by n columns (CUB, CSI n D).
Moves the cursor right by n columns (CUF, CSI n C).
Deletes count characters at the cursor column, shifting the remainder of the line left and filling the vacated right cells with blanks using the active pen attribute (DCH, CSI n P). Cursor position is not changed.
Deletes count lines starting at the cursor row within the active scroll region (DL, CSI n M).
Switches to the alternate screen buffer with cursor save (CSI ? 1049 h).
Switches to the alternate screen buffer without saving the primary cursor state.
Erases count characters starting at the cursor column without shifting the remainder of the line (ECH, CSI n X).
Erases the entire current line without moving the cursor (EL 2, CSI 2 K).
Erases the entire visible screen without moving the cursor (ED 2, CSI 2 J).
Erases from the start of the current line through the cursor (EL 1, CSI 1 K).
Erases from the cursor to the end of the current line (EL 0, CSI 0 K).
Erases all scrollback history while preserving the visible viewport (xterm/VTE ED 3, CSI 3 J).
Erases from the start of the visible screen through the cursor (ED 1, CSI 1 J).
Erases from the cursor to the end of the visible screen (ED 0, CSI 0 J).
Executes DECCOLM (CSI ? 3 h / CSI ? 3 l) as a core-owned macro command.
Returns to the primary screen buffer with cursor restore (CSI ? 1049 l).
Returns to the primary screen buffer without restoring a saved cursor.
Returns scrollback history followed by the visible screen as a newline-joined string, oldest line first.
Returns the attributes at a screen position as an unpacked Attributes object.
Returns the display/base codepoint at [col, row].
Returns one atomic packed snapshot for input encoders.
Returns the content of a visible row as a string, trimming trailing blank cells while preserving intentional space characters.
Returns one atomic packed snapshot of durable mode state.
Returns an immutable snapshot of the current durable mode flags.
Returns the primary packed cell attribute word at [col, row].
Returns the extended packed cell attribute word at [col, row].
Returns the visible screen as a newline-joined string, top to bottom.
Advances the cursor to the next tab stop (HT, 0x09).
Inserts count blank cells at the cursor column, shifting existing cells right (ICH, CSI n @). Cells pushed past the right margin are discarded.
Inserts count blank lines at the cursor row within the active scroll region (IL, CSI n L).
Pops the Kitty keyboard flags from the stack up to count times.
Moves the cursor to an absolute position (CUP / HVP, CSI row ; col H).
Pushes the current Kitty keyboard progressive-enhancement flags to the stack, and sets the new active flags.
Enqueues the color query response for a dynamic target (10, 11, or 12).
Enqueues the color query response for a specific 256-color palette index.
Enqueues the response for a DCS DECRQSS request.
Enqueues the response for a DCS XTGETTCAP request.
Enqueues a device attributes (DA) report response.
Enqueues a device status report (DSR) response.
Enqueues a window report response.
Resets the cursor to the home position (col=0, row=0).
Resets the scroll region to the full viewport and homes the cursor.
Restores the core-owned state saved by saveCursor (DECRC, ESC 8).
Executes Reverse Index (RI, ESC M).
Saves the core-owned cursor state (DECSC, ESC 7).
Scrolls the active scroll region down by one line (SD, CSI 1 T).
Selectively erases the entire current line without moving the cursor (DECSEL 2).
Selectively erases the entire visible screen without moving the cursor (DECSED 2).
Selectively erases from the start of the current line through the cursor (DECSEL 1).
Selectively erases from the cursor to the end of the current line (DECSEL 0).
Selectively erases from the start of the visible screen through the cursor (DECSED 1).
Selectively erases from the cursor through the end of the visible screen (DECSED 0).
Toggles application cursor key mode (DECCKM, CSI ? 1 h / CSI ? 1 l).
Toggles application keypad mode (DECNKM).
Enables or disables DECAWM auto-wrap (CSI ? 7 h / CSI ? 7 l).
Toggles urgent bell mode (?1042).
Enables or disables bracketed paste reporting (CSI ? 2004 h / CSI ? 2004 l).
Toggles cursor blink presentation state.
Sets the cursor shape/style.
Toggles cursor visibility presentation state (DECTCEM, CSI ? 25 h / CSI ? 25 l).
Sets the default cursor shape/style restored on reset.
Updates a dynamic target color (foreground, background, or cursor color).
Enables or disables focus in/out reporting (CSI ? 1004 h / CSI ? 1004 l).
Sets the format-other-keys wire format used when modify-other-keys applies.
Sets the active OSC 8 hyperlink id stamped onto future printed cells.
Sets the xterm icon title.
Enables or disables Insert Replace Mode (IRM, CSI 4 h / CSI 4 l).
Sets active Kitty keyboard progressive-enhancement flags.
Enables or disables left/right margin mode (DECLRMM, CSI ? 69 h / CSI ? 69 l).
Sets the active horizontal margins (DECSLRM, CSI left ; right s).
Sets the modify-other-keys reporting level.
Sets the active mouse report encoding mode used by terminal-to-host reporting.
Sets the active mouse tracking mode used by terminal-to-host reporting.
Enables or disables New Line Mode (LNM, CSI 20 h / CSI 20 l).
Enables or disables Origin Mode (DECOM, CSI ? 6 h / CSI ? 6 l).
Updates an individual color index in the active 256-color palette.
Sets the active pen attributes used by all subsequent write and erase operations.
Sets the active pen attributes using explicit default, indexed, or RGB colors.
Toggles pop on bell mode (?1043).
Toggles reverse-video presentation state (DECSCNM, CSI ? 5 h / CSI ? 5 l).
Sets the active vertical scroll region (DECSTBM, CSI top ; bottom r).
Enables or disables selective-erase protection on future printed cells (DECSCA).
Toggles synchronized output mode (DECSET/DECRST ?2026).
Sets a tab stop at the current cursor column (HTS, ESC H).
Sets the theme-configured color palette for the terminal session.
Controls how East Asian Ambiguous codepoints are measured for future writes.
Updates the recorded window minimization state.
Updates the recorded window size in pixels.
Sets the xterm window title.
Writes one pre-segmented grapheme cluster to the grid.
Writes one Unicode scalar value at the cursor position using the active pen attributes, then advances the cursor.