EscapeHandler class abstract

Receives decoded escape sequences from EscapeParser.

The terminal frontend implements this interface to react to control sequences (SBC, ANSI, CSI, OSC, DCS, DEC private modes, SGR and the Kitty keyboard / graphics protocols). Every method corresponds to one decoded sequence; unknown or unsupported sequences are routed to the unknown* / unsupported* callbacks instead of being dropped.

Implementations should treat these calls as ordered events: the parser invokes them in the exact order the sequences appear in the input stream.

Implementers

Constructors

EscapeHandler()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

backspaceReturn() → void
Move the cursor back one column (BS, \x08).
bell() → void
Ring the terminal bell (BEL, \x07).
carriageReturn() → void
Move the cursor to the first column of the current line (CR, \x0d).
clearAllTabStops() → void
Clear all tab stops (CSI 3 g, TBC 3).
clearAltBuffer() → void
Clear the alternate screen buffer.
clearTabStopUnderCursor() → void
Clear the tab stop under the cursor (CSI g, TBC 0).
cursorNextLine(int amount) → void
Move the cursor to the first column amount rows down (CSI n E, CNL).
cursorPrecedingLine(int amount) → void
Move the cursor to the first column amount rows up (CSI n F, CPL).
deleteChars(int amount) → void
Delete amount characters at the cursor (CSI n P, DCH).
deleteLines(int amount) → void
Delete amount lines below the cursor (CSI n M, DL).
designateCharset(int charset, int name) → void
Designate a character set for G0–G3 (ESC ( / ESC ) / ESC * / ESC +).
eraseChars(int amount) → void
Erase amount characters at the cursor, leaving the cursor in place (CSI n X, ECH).
eraseDisplay() → void
Erase the entire screen (CSI 2 J, ED).
eraseDisplayAbove() → void
Erase from the top of the screen to the cursor (CSI 1 J, ED).
eraseDisplayBelow() → void
Erase from the cursor to the bottom of the screen (CSI 0 J, ED).
eraseLine() → void
Erase the entire line (CSI 2 K, EL).
eraseLineLeft() → void
Erase from the start of the line to the cursor (CSI 1 K, EL).
eraseLineRight() → void
Erase from the cursor to the end of the line (CSI 0 K, EL).
eraseScrollbackOnly() → void
Erase the scrollback buffer, keeping the visible screen (CSI 3 J, ED).
graphicsCommandEnd() → void
Finish the in-flight graphics command.
graphicsCommandStart(Map<String, String> args) → void
Start a graphics command with its parsed a=… key-value arguments (CSI _ G …).
graphicsDataChunk(List<int> data) → void
Append a chunk of raw payload data for the in-flight graphics command.
handleClipboard(String target, String data) → void
Handle an OSC 52 clipboard request with target (e.g. c) and base64-encoded data.
handleColorStack({required bool push}) → void
Push (OSC 30001) or pop (OSC 30101) the color stack.
handleDcs(String command, List<String> args, List<int>? data) → void
Handle DCS (Device Control String) sequences. Used for the Remote Control protocol: DCS +q query ST.
handleNotification(List<String> args) → void
Handle a desktop notification: OSC 99 (title/body form) or OSC 777 (command form).
handleShellIntegration(String cmd, List<String> args) → void
Handle an OSC 133 shell integration command (e.g. prompt/command boundaries).
handleTextSizeQuery(int command) → void
Handle an OSC text-size query.
index() → void
Move the cursor down one line without scrolling (IND, ESC D).
insertBlankChars(int amount) → void
Insert amount blank characters at the cursor (CSI n @, ICH).
insertLines(int amount) → void
Insert amount blank lines above the cursor (CSI n L, IL).
lineFeed() → void
Move the cursor down one line, scrolling if at the bottom (LF, \x0a).
moveCursorX(int offset) → void
Move the cursor offset columns; negative moves left (CUB), positive moves right (CUF).
moveCursorY(int n) → void
Move the cursor n rows; negative moves up (CUU), positive moves down (CUD).
nextLine() → void
Move the cursor to the start of the next line (NEL, ESC E).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
popKittyFlags() → void
Pop the top of the Kitty keyboard flags stack (CSI > - u).
pushKittyFlags(int flags) → void
Push flags onto the Kitty keyboard flags stack (CSI > + n u).
repeatPreviousCharacter(int n) → void
Repeat the previous output character n times (CSI n b, REP).
resetBackground() → void
Reset the background color to the default (SGR 49).
resetCursorStyle() → void
Reset the cursor style to the default (SGR 0).
resetForeground() → void
Reset the foreground color to the default (SGR 39).
resetUnderlineColor() → void
Reset the underline color to the default (SGR 59).
resize(int cols, int rows) → void
Resize the terminal to cols columns and rows rows.
restoreCursor() → void
Restore the previously saved cursor position and attributes (ESC 8).
reverseIndex() → void
Move the cursor up one line, scrolling if at the top (RI, ESC M).
saveCursor() → void
Save the current cursor position and attributes (ESC 7).
scrollDown(int amount) → void
Scroll the visible screen down amount lines (CSI n T, SD).
scrollUp(int amount) → void
Scroll the visible screen up amount lines (CSI n S, SU).
sendCursorPosition() → void
Reply to a cursor position query (CSI 6 n, CPR).
sendOperatingStatus() → void
Reply to an operating status query (CSI 5 n, DSR).
sendPrimaryDeviceAttributes() → void
Reply to a primary device attributes query (CSI c, DA1).
sendSecondaryDeviceAttributes() → void
Reply to a secondary device attributes query (CSI > c, DA2).
sendSize() → void
Reply to a window/terminal size query.
sendTertiaryDeviceAttributes() → void
Reply to a tertiary device attributes query (CSI = c, DA3).
setAltBufferMouseScrollMode(bool enabled) → void
Enable or disable alternate buffer mouse scroll reporting (DECSET 1007).
setAnsiMode(bool enabled) → void
Enable or disable ANSI mode (DECSET/DECRST 2, DECANM). When disabled the terminal operates in VT52 mode.
setAppKeypadMode(bool enabled) → void
Enable or disable application keypad mode (ESC = / ESC >, DECPAM/ DECPNM).
setAutoWrapMode(bool enabled) → void
Enable or disable auto-wrap at the right margin (DECSET/DECRST 7, DECAWM).
setBackgroundColor16(int color) → void
Set the background color from the 16-color palette (SGR 40–47).
setBackgroundColor256(int index) → void
Set the background color from the 256-color palette (SGR 48 ; 5 ; n).
setBackgroundColorRgb(int r, int g, int b) → void
Set the background color to an RGB value (SGR 48 ; 2 ; r ; g ; b).
setBracketedPasteMode(bool enabled) → void
Enable or disable bracketed paste mode (DECSET/DECRST 2004).
setColumnMode(bool enabled) → void
Enable or disable 132-column mode (DECSET/DECRST 3, DECCOLM).
setCursor(int x, int y) → void
Move the cursor to row y, column x (CSI x ; y H, CUP).
Make the text blink (SGR 5).
setCursorBlinkMode(bool enabled) → void
Enable or disable the blinking cursor (DECSET/DECRST 12).
setCursorBold() → void
Make the text bold (SGR 1).
setCursorFaint() → void
Make the text faint / dim (SGR 2).
setCursorInverse() → void
Reverse video: swap foreground and background (SGR 7).
setCursorInvisible() → void
Make the text invisible (SGR 8).
setCursorItalic() → void
Make the text italic (SGR 3).
setCursorKeysMode(bool enabled) → void
Enable or disable application cursor keys (DECSET/DECRST 1, DECCKM).
setCursorStrikethrough() → void
Strike through the text (SGR 9).
setCursorUnderline() → void
Underline the text (SGR 4).
setCursorUnderlineStyle(int style) → void
Set the underline style, e.g. 4:0 straight or 4:3 curly (SGR 4 : n).
setCursorVisibleMode(bool enabled) → void
Show or hide the cursor (DECSET/DECRST 25, DECTCEM).
setCursorX(int x) → void
Move the cursor to column x on the current row (CSI x G, CHA).
setCursorY(int y) → void
Move the cursor to row y in the current column (CSI y d, VPA).
setForegroundColor16(int color) → void
Set the foreground color from the 16-color palette (SGR 30–37).
setForegroundColor256(int index) → void
Set the foreground color from the 256-color palette (SGR 38 ; 5 ; n).
setForegroundColorRgb(int r, int g, int b) → void
Set the foreground color to an RGB value (SGR 38 ; 2 ; r ; g ; b).
Set or clear the OSC 8 hyperlink; a null id clears it.
setIconName(String name) → void
Set the icon name (OSC 1).
setInsertMode(bool enabled) → void
Enable or disable insert mode (SM/RM 4, IRM).
setKittyMode(bool enabled) → void
Enable or disable the Kitty keyboard protocol (CSI > n u).
setLineFeedMode(bool enabled) → void
Enable or disable line feed / new line mode (SM/RM 20, LNM).
setMargins(int i, [int? bottom]) → void
Set the scrolling region to rows i through bottom (CSI r, DECSTBM).
setMouseMode(MouseMode mode) → void
Set the mouse reporting mode (DECSET/DECRST 9, 1000–1006).
setMouseReportMode(MouseReportMode mode) → void
Set the mouse report encoding (e.g. SGR 1006, UTF-8 1005).
setOriginMode(bool enabled) → void
Enable or disable origin mode (DECSET/DECRST 6, DECOM).
setReportFocusMode(bool enabled) → void
Enable or disable focus reporting (DECSET/DECRST 1004).
setReverseDisplayMode(bool enabled) → void
Enable or disable reverse display (DECSET/DECRST 5, DECSCNM).
setTapStop() → void
Set a tab stop at the current cursor column (HTS, ESC H).
setTitle(String name) → void
Set the window/terminal title (OSC 0/2).
setUnderlineColor256(int color) → void
Set the underline color from the 256-color palette (SGR 58 ; 5 ; n).
setUnderlineColorRgb(int r, int g, int b) → void
Set the underline color to an RGB value (SGR 58 ; 2 ; r ; g ; b).
setUnknownDecMode(int mode, bool enabled) → void
An unrecognized DEC private mode mode was set or reset.
setUnknownMode(int mode, bool enabled) → void
An unrecognized ANSI mode mode was set or reset.
shiftIn() → void
Switch back to the G0 character set (SI, \x0f).
shiftOut() → void
Switch to the G1 character set (SO, \x0e).
tab() → void
Move the cursor to the next tab stop (HT, \x09).
toString() String
A string representation of this object.
inherited
unknownCSI(int finalByte) → void
An unrecognized CSI sequence with final byte finalByte was received.
unknownEscape(int char) → void
An unrecognized ESC sequence with final byte char was received.
unknownOSC(String code, List<String> args) → void
An unrecognized OSC sequence with code code was received.
unknownSBC(int char) → void
An unrecognized single-byte control character was received.
Disable blink (SGR 25).
unsetCursorBold() → void
Disable bold (SGR 22).
unsetCursorFaint() → void
Disable faint / dim (SGR 22).
unsetCursorInverse() → void
Disable reverse video (SGR 27).
unsetCursorInvisible() → void
Make the text visible again (SGR 28).
unsetCursorItalic() → void
Disable italic (SGR 23).
unsetCursorStrikethrough() → void
Disable strikethrough (SGR 29).
unsetCursorUnderline() → void
Disable underline (SGR 24).
unsupportedStyle(int param) → void
An unsupported SGR style parameter param was received.
useAltBuffer() → void
Switch to the alternate screen buffer.
useMainBuffer() → void
Switch back to the main screen buffer.
writeChar(int char) → void
Write a single character to the screen.
writeString(String text) → void
Write a batch of consecutive plain-text characters. Called by EscapeParser when it detects a run of printable characters with no escape sequences or control characters in between. Default implementation falls back to per-character writeChar.

Operators

operator ==(Object other) bool
The equality operator.
inherited