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.

Functions

Link copied to clipboard
abstract fun appendToPreviousCluster(codepoint: Int)

Appends one grapheme-continuation codepoint to the most recently written printable cell without moving the cursor.

Link copied to clipboard
abstract fun applyKittyKeyboardFlags(flags: Int, applicationMode: Int)

Kitty keyboard progressive-enhancement flag application, CSI = flags ; mode u.

Link copied to clipboard
abstract fun backspace()

Moves the cursor one column to the left (BS, 0x08).

Link copied to clipboard
abstract fun bell()

Triggers the terminal bell/alert sound (BEL, 0x07).

Link copied to clipboard
abstract fun carriageReturn()

Moves the cursor to the left margin on the current row (CR, 0x0D).

Link copied to clipboard
abstract fun clearAllTabStops()

Clears all tab stops (TBC 3).

Link copied to clipboard
abstract fun clearTabStop()

Clears the tab stop at the current cursor column (TBC 0).

Link copied to clipboard
abstract fun cursorBackward(n: Int)

Moves the cursor backward (left) by n columns.

Link copied to clipboard
abstract fun cursorBackwardTabs(n: Int)

Moves the cursor backward (left) by n tab stops.

Link copied to clipboard
abstract fun cursorDown(n: Int)

Moves the cursor down by n rows.

Link copied to clipboard
abstract fun cursorForward(n: Int)

Moves the cursor forward (right) by n columns.

Link copied to clipboard
abstract fun cursorForwardTabs(n: Int)

Moves the cursor forward (right) by n tab stops.

Link copied to clipboard
abstract fun cursorNextLine(n: Int)

Moves the cursor down by n lines and positions it at the beginning of the line.

Link copied to clipboard
abstract fun cursorPreviousLine(n: Int)

Moves the cursor up by n lines and positions it at the beginning of the line.

Link copied to clipboard
abstract fun cursorUp(n: Int)

Moves the cursor up by n rows.

Link copied to clipboard
abstract fun decaln()

DEC Screen Alignment Test (DECALN): ESC # 8.

Link copied to clipboard
abstract fun deleteCharacters(n: Int)

Deletes n characters starting at the cursor position (DCH).

Link copied to clipboard
abstract fun deleteLines(n: Int)

Deletes n lines starting at the cursor row (DL).

Link copied to clipboard
abstract fun deminimizeWindow()

De-minimizes (restores/de-iconifies) the terminal window.

Link copied to clipboard
abstract fun endHyperlink()

Ends the active OSC 8 hyperlink context.

Link copied to clipboard
abstract fun eraseCharacters(n: Int)

Erases n characters starting at the cursor position (ECH).

Link copied to clipboard
abstract fun eraseInDisplay(mode: Int, selective: Boolean)

Erases cells in the viewport (ED / DECSED).

Link copied to clipboard
abstract fun eraseInLine(mode: Int, selective: Boolean)

Erases cells in the active line (EL / DECSEL).

Link copied to clipboard
abstract fun insertCharacters(n: Int)

Inserts n blank characters at the cursor position (ICH).

Link copied to clipboard
abstract fun insertLines(n: Int)

Inserts n blank lines at the cursor row (IL).

Link copied to clipboard
abstract fun lineFeed()

Executes a line feed (LF, 0x0A), moving the cursor down one row.

Link copied to clipboard
abstract fun lowerWindow()

Lowers the terminal window to the bottom of the window stack.

Link copied to clipboard
abstract fun minimizeWindow()

Minimizes (iconifies) the terminal window.

Link copied to clipboard
abstract fun moveWindow(x: Int, y: Int)

Moves the terminal window to the specified screen coordinates in pixels.

Link copied to clipboard
abstract fun nextLine()

Moves the cursor to the left margin on the next row (NEL, ESC E).

Link copied to clipboard
abstract fun popKittyKeyboardFlags(count: Int)

Kitty keyboard stack pop, CSI < count u.

Link copied to clipboard
abstract fun popTitleStack(scope: Int)

Pops the xterm title stack for the given scope.

Link copied to clipboard
abstract fun pushKittyKeyboardFlags(flags: Int)

Kitty keyboard stack push, CSI > flags u.

Link copied to clipboard
abstract fun pushTitleStack(scope: Int)

Xterm title stack push/pop scopes:

Link copied to clipboard
abstract fun queryDynamicColor(target: Int)

Queries a dynamic color.

Link copied to clipboard
abstract fun queryPaletteColor(index: Int)

Queries an individual color in the active 256-color palette.

Link copied to clipboard
abstract fun queryStatusString(query: String)

Queries a status string (DECRQSS).

Link copied to clipboard
abstract fun queryTerminfo(rawPayload: String)

Queries terminfo capabilities (XTGETTCAP).

Link copied to clipboard
abstract fun raiseWindow()

Raises the terminal window to the front of the window stack.

Link copied to clipboard
open fun requestClipboard(selection: String, encodedData: String)

Reports an OSC 52 terminal clipboard request.

Link copied to clipboard
abstract fun requestDeviceAttributes(kind: Int, parameter: Int)

DA request.

Link copied to clipboard
abstract fun requestDeviceStatusReport(mode: Int, decPrivate: Boolean)

DSR/CPR request: CSI Ps n or CSI ? Ps n.

Link copied to clipboard
abstract fun requestWindowReport(mode: Int)

Safe xterm window report request.

Link copied to clipboard
abstract fun resetAttributes()

Resets all active pen attributes to defaults (SGR 0).

Link copied to clipboard
abstract fun resetKeyFormatOption(resource: Int)

Resets one xterm key format option, CSI > Pp f.

Link copied to clipboard
abstract fun resetKeyFormatOptions()

Resets all supported xterm key format options, CSI > f.

Link copied to clipboard
abstract fun resetKeyModifierOption(resource: Int)

Resets one xterm key modifier option, CSI > Pp m.

Link copied to clipboard

Resets all supported xterm key modifier options, CSI > m.

Link copied to clipboard
abstract fun resetTerminal()

RIS full terminal reset: ESC c.

Link copied to clipboard
abstract fun resizeWindow(rows: Int, columns: Int)

Requests that the host resize the terminal window to the specified grid dimensions.

Link copied to clipboard
abstract fun restoreCursor()

Restores the cursor position, SGR attributes, wrap state, and origin mode.

Link copied to clipboard
abstract fun reverseIndex()

Executes a reverse index (RI, ESC M), moving the cursor up one row.

Link copied to clipboard
abstract fun saveCursor()

Saves the current cursor position, SGR attributes, wrap state, and origin mode.

Link copied to clipboard
abstract fun scrollDown(n: Int)

Scrolls the active scroll region down by n lines (SD).

Link copied to clipboard
abstract fun scrollUp(n: Int)

Scrolls the active scroll region up by n lines (SU).

Link copied to clipboard
abstract fun setAnsiMode(mode: Int, enable: Boolean)

ANSI mode set/reset.

Link copied to clipboard
abstract fun setBackgroundDefault()

Resets background color to the default.

Link copied to clipboard
abstract fun setBackgroundIndexed(index: Int)

Sets background indexed color.

Link copied to clipboard
abstract fun setBackgroundRgb(red: Int, green: Int, blue: Int)

Sets background RGB color.

Link copied to clipboard
abstract fun setBlink(enabled: Boolean)

Sets blinking style.

Link copied to clipboard
abstract fun setBold(enabled: Boolean)

Sets bold weight.

Link copied to clipboard
abstract fun setConceal(enabled: Boolean)

Sets conceal style.

Link copied to clipboard

Reports the shell's current working directory as an OSC 7 file URI.

Link copied to clipboard
abstract fun setCursorAbsolute(row: Int, col: Int)

Row and column are parser-translated to zero-origin before handoff. The core may clamp; the parser must not.

Link copied to clipboard
abstract fun setCursorColumn(col: Int)

Column is parser-translated to zero-origin before handoff. The core may clamp; the parser must not.

Link copied to clipboard
abstract fun setCursorRow(row: Int)

Row is parser-translated to zero-origin before handoff. The core may clamp; the parser must not.

Link copied to clipboard
abstract fun setCursorStyle(style: Int)

Sets the shape/style of the cursor.

Link copied to clipboard
abstract fun setDecMode(mode: Int, enable: Boolean)

DEC private mode set/reset.

Link copied to clipboard
abstract fun setDynamicColor(target: Int, color: Int)

Sets a dynamic color (foreground, background, or cursor color).

Link copied to clipboard
abstract fun setFaint(enabled: Boolean)

Sets faint (dim) weight.

Link copied to clipboard
abstract fun setForegroundDefault()

Resets foreground color to the default.

Link copied to clipboard
abstract fun setForegroundIndexed(index: Int)

Sets foreground indexed color.

Link copied to clipboard
abstract fun setForegroundRgb(red: Int, green: Int, blue: Int)

Sets foreground RGB color.

Link copied to clipboard
abstract fun setIconAndWindowTitle(title: String)

Sets both icon and window titles.

Link copied to clipboard
abstract fun setIconTitle(title: String)

Sets the icon title.

Link copied to clipboard
abstract fun setInverse(enabled: Boolean)

Sets inverse (reverse-video) style.

Link copied to clipboard
abstract fun setItalic(enabled: Boolean)

Sets italic style.

Link copied to clipboard
abstract fun setKeyFormatOption(resource: Int, value: Int)

Xterm key format option set, CSI > Pp ; Pv f.

Link copied to clipboard
abstract fun setKeyModifierOption(resource: Int, value: Int)

Xterm key modifier option set, CSI > Pp ; Pv m.

Link copied to clipboard
abstract fun setLeftRightMargins(left: Int, right: Int)

DECSLRM left/right margins.

Link copied to clipboard
abstract fun setMaximized(maximize: Boolean)

Maximizes or restores the terminal window.

Link copied to clipboard
abstract fun setOverline(enabled: Boolean)

Sets overline decoration.

Link copied to clipboard
abstract fun setPaletteColor(index: Int, color: Int)

Sets a specific ANSI indexed color.

Link copied to clipboard
abstract fun setScrollRegion(top: Int, bottom: Int)

DECSTBM scroll region.

Link copied to clipboard
abstract fun setSelectiveEraseProtection(enabled: Boolean)

Sets selective erase protection (DECSCA).

Link copied to clipboard
abstract fun setStrikethrough(enabled: Boolean)

Sets strikethrough decoration.

Link copied to clipboard
abstract fun setTabStop()

Sets a tab stop at the current cursor column (HTS).

Link copied to clipboard

Resets underline color to the default.

Link copied to clipboard
abstract fun setUnderlineColorIndexed(index: Int)

Sets underline indexed color.

Link copied to clipboard
abstract fun setUnderlineColorRgb(red: Int, green: Int, blue: Int)

Sets underline RGB color.

Link copied to clipboard
abstract fun setUnderlineStyle(style: Int)

Sets underline style.

Link copied to clipboard
abstract fun setWindowTitle(title: String)

Sets the window title.

Link copied to clipboard

Emits a FinalTerm-style OSC 133 shell integration marker.

Link copied to clipboard
abstract fun showNotification(title: String, body: String, level: NotificationLevel)

Requests a desktop notification.

Link copied to clipboard
abstract fun softReset()

DECSTR soft terminal reset: CSI ! p.

Link copied to clipboard
abstract fun startHyperlink(uri: String, id: String?)

Starts an OSC 8 hyperlink context.

Link copied to clipboard
abstract fun tab()

Advances the cursor to the next tab stop (HT, 0x09).

Link copied to clipboard
abstract fun writeCluster(codepoints: IntArray, length: Int)

Writes a pre-segmented multi-codepoint grapheme cluster to the grid.

Link copied to clipboard
abstract fun writeCodepoint(codepoint: Int)

Writes a single Unicode codepoint to the grid at the cursor position.