TerminalCommandSink
Parser-facing terminal command sink.
This is the narrow semantic handoff boundary from :terminal-parser to :terminal-core.
Rules:
The parser emits terminal operations.
The sink/core owns grid physics, bounds clamping, wrapping, margins, storage, and mode persistence.
The parser must not know terminal width, height, cursor bounds, or rendering details.
Inheritors
Properties
Invalidation token for incomplete graphics uploads. Change it synchronously when reset, destructive clearing or an effective screen switch invalidates staging, including mutations performed outside this sink. The parser checks the token at APC entry and termination, covering partial headers and payloads across reads. Repeated no-op screen requests do not require a new token.
Actual active screen, observed synchronously on the parser's serialized command thread. Must reflect effective transitions before setDecMode returns, including rejected or repeated requests. Parser uses it for screen-local charset saves; do not shadow host state. A sink without an alternate screen returns false.
Functions
Applies one ordered OSC 21 batch. The request and its key bytes are borrowed only for this synchronous call. Queries observe preceding mutations and form one combined reply. Host palette and terminal-response permissions apply.
Consumes a complete graphics command or a transfer validation failure. data contains Base64-decoded payload bytes in 0 until length; image format decoding and admission belong downstream. result is the transfer result, not a permission decision. A failure must not commit partial data. Both command and data are borrowed for this synchronous callback only.
Kitty keyboard progressive-enhancement flag application, CSI = flags ; mode u.
Moves the cursor to the left margin on the current row (CR, 0x0D).
Clears all tab stops (TBC 3).
Clears the tab stop at the current cursor column (TBC 0).
Moves the cursor backward (left) by n columns.
Moves the cursor backward (left) by n tab stops.
Moves the cursor down by n rows.
Moves the cursor forward (right) by n columns.
Moves the cursor forward (right) by n tab stops.
Moves the cursor down by n lines and positions it at the beginning of the line.
Moves the cursor up by n lines and positions it at the beginning of the line.
Deletes n characters starting at the cursor position (DCH).
Deletes columns (DECDC) across every row of the active vertical scroll region.
Deletes n lines starting at the cursor row (DL).
De-minimizes (restores/de-iconifies) the terminal window.
Disables one xterm key modifier option, CSI > Ps n.
Ends the active OSC 8 hyperlink context.
Erases n characters starting at the cursor position (ECH).
Erases cells in the viewport (ED / DECSED).
Erases cells in the active line (EL / DECSEL).
Inserts n blank characters at the cursor position (ICH).
Inserts blank columns (DECIC) across every row of the active vertical scroll region.
Inserts n blank lines at the cursor row (IL).
Lowers the terminal window to the bottom of the window stack.
Minimizes (iconifies) the terminal window.
Moves the terminal window to the specified screen coordinates in pixels.
Kitty keyboard stack pop, CSI < count u.
Pops the xterm title stack for the given scope.
Saves the current colors on the terminal's bounded color stack (OSC 30001), subject to palette permission.
Kitty keyboard stack push, CSI > flags u.
Xterm title stack push/pop scopes:
Queries a dynamic color.
Queries an individual color in the active 256-color palette.
Queries a status string (DECRQSS).
Queries terminfo capabilities (XTGETTCAP).
Raises the terminal window to the front of the window stack.
Reports an OSC 52 terminal clipboard request.
DA request.
DSR/CPR request: CSI Ps n or CSI ? Ps n.
Requests an xterm key-format resource (XTQFMTKEYS); the host owns response permission.
Requests one xterm key modifier option, CSI ? Pp m.
Requests the active Kitty keyboard progressive-enhancement flag report for parameterless CSI ? u.
Requests one ANSI or DEC private mode status; host policy controls replies.
Safe xterm window report request.
Resets all active pen attributes to defaults (SGR 0).
Restores one dynamic color to its host-configured theme default (OSC 110/111/112).
Resets one xterm key format option, CSI > Pp f.
Resets all supported xterm key format options, CSI > f.
Resets one xterm key modifier option, CSI > Pp m.
Resets all supported xterm key modifier options, CSI > m.
Restores indexed colors to the host-configured theme defaults (OSC 104).
RIS full terminal reset: ESC c.
Requests that the host resize the terminal window to the specified grid dimensions.
Restores the cursor position, SGR attributes, wrap state, and origin mode.
Executes a reverse index (RI, ESC M), moving the cursor up one row.
Saves the current cursor position, SGR attributes, wrap state, and origin mode.
Resolves parameterless CSI s against the current horizontal-margin mode (DECLRMM).
Scrolls the active scroll region down by n lines (SD).
ANSI mode set/reset.
Selects the DECSACE extent used by subsequent DECCARA and DECRARA commands.
Resets background color to the default.
Sets background indexed color.
Sets background RGB color.
Sets conceal style.
Reports the shell's current working directory as an OSC 7 file URI.
Row and column are parser-translated to zero-origin before handoff. The core may clamp; the parser must not.
Column is parser-translated to zero-origin before handoff. The core may clamp; the parser must not.
Row is parser-translated to zero-origin before handoff. The core may clamp; the parser must not.
Sets the shape/style of the cursor.
DEC private mode set/reset.
Sets a dynamic color (foreground, background, or cursor color).
Resets foreground color to the default.
Sets foreground indexed color.
Sets foreground RGB color.
Sets both icon and window titles.
Sets the icon title.
Sets inverse (reverse-video) style.
Xterm key format option set, CSI > Pp ; Pv f.
Xterm key modifier option set, CSI > Pp ; Pv m.
DECSLRM left/right margins.
Maximizes or restores the terminal window.
Sets overline decoration.
Sets a specific ANSI indexed color.
Requests a validated OSC 22 mouse pointer shape. A null shape restores the host default. Presentation precedence belongs downstream.
DECSTBM scroll region.
Sets selective erase protection (DECSCA).
Requests Shift as a mouse-report modifier when enabled (XTSHIFTESCAPE); false restores local Shift override.
Sets strikethrough decoration.
Sets a tab stop at the current cursor column (HTS).
Resets underline color to the default.
Sets underline indexed color.
Sets underline RGB color.
Sets underline style.
Sets the window title.
Emits a FinalTerm-style OSC 133 shell integration marker.
Requests a desktop notification.
Starts an OSC 8 hyperlink context.
Updates the most recently published grapheme with its complete retained sequence.
Writes a pre-segmented multi-codepoint grapheme cluster to the grid.
Writes a single Unicode codepoint to the grid at the cursor position.