^[control-codes
live in libghostty-vt

Control sequences

View as Markdown

CSI, then parameters, then a final byte: the bulk of what a terminal understands. They are listed here by mnemonic; by final byte lists them by the byte they end with.

CBT Cursor Backward Tabulation CSI Pn Z …
CHA Cursor Character Absolute CSI Pn G …
CHT Cursor Horizontal Tabulation CSI Pn I …
CNL Cursor Next Line CSI Pn E …
CPL Cursor Preceding Line CSI Pn F …
CPR Active Position Report
CSI u Kitty Keyboard Protocol CSI = Ps ; Pm u …
CTC Cursor Tabulation Control CSI Pm W …
CUB Cursor Backward CSI Pn D …
CUD Cursor Down CSI Pn B …
CUF Cursor Forward CSI Pn C …
CUP Cursor Position CSI Pl ; Pc H …
CUU Cursor Up CSI Pn A …
DA Device Attributes CSI Ps c …
DCH Delete Character CSI Pn P …
DECCARA Change Attributes in Rectangular Area CSI Pt ; Pl ; Pb ; Pr ; Pm $ r …
DECCIR Cursor Information Report
DECCKSR Memory Checksum Report
DECCRA Copy Rectangular Area CSI Pm $ v …
DECDC Delete Column
DECDSR DEC Device Status Reports CSI ? Ps n …
DECEFR Enable Filter Rectangle
DECELR Enable Locator Reports CSI Ps ; Pu ' z …
DECERA Erase Rectangular Area CSI Pt ; Pl ; Pb ; Pr $ z …
DECFRA Fill Rectangular Area CSI Pch ; Pt ; Pl ; Pb ; Pr $ x …
DECIC Insert Column CSI Pn ' } …
DECID Identify Terminal
DECLKD Locator Key Definition
DECMSR Macro Space Report
DECRARA Reverse Attributes Rectangular Area
DECRPM Report Mode
DECRQCRA Request Checksum of Rectangular Area CSI Pi ; Pp ; Pt ; Pl ; Pb ; Pr * y …
DECRQLP Request Locator Position
DECRQM Request Mode CSI ? Pd $ p …
DECRQPSR Request Presentation State Report CSI Ps $ w …
DECRQTSR Request Terminal State Report CSI Ps $ u …
DECRST DEC Private Mode Reset CSI ? Pm l …
DECRSTS Restore Terminal State
DECSACE Select Attribute Change Extent
DECSASD Select Active Status Display CSI Ps $ } …
DECSCA Select Character Protection Attribute CSI Ps " q …
DECSCL Select Conformance Level CSI Pl ; Pc " p …
DECSCPP Set Columns Per Page CSI Pn $ | …
DECSCUSR Set Cursor Style CSI Ps SP q …
DECSED Selective Erase in Display
DECSEL Selective Erase in Line
DECSERA Selective Erase Rectangular Area
DECSET DEC Private Mode Set CSI ? Pm h …
DECSLE Select Locator Events
DECSLRM Set Left and Right Margins CSI Pl ; Pr s …
DECSNLS Select Number of Lines per Screen CSI Pn * | …
DECSR Secure Reset CSI Pr + p …
DECSRC Secure Reset Confirmation
DECSSDT Select Status Display Type
DECST8C Set Tab at Every 8 Columns
DECSTBM Set Top and Bottom Margins CSI Pt ; Pb r …
DECSTR Soft Terminal Reset CSI ! p …
DECTABSR Tabulation Stop Report
DECTSR Terminal State Report
DECTST Invoke Confidence Test CSI 4 ; Ps … y …
DECXCPR Extended Cursor Position Report
DL Delete Line CSI Pn M …
DSR Device Status Report CSI Ps n …
ECH Erase Character CSI Pn X …
ED Erase in Display CSI Ps J …
EL Erase in Line CSI Ps K …
HPA Character Position Absolute CSI Pn ` …
HPB Character Position Backward CSI Pn j …
HPR Character Position Forward CSI Pn a …
HVP Horizontal and Vertical Position CSI Pl ; Pc f …
ICH Insert Character CSI Pn @ …
IL Insert Line CSI Pn L …
MC Media Copy CSI Ps i …
NP Next Page CSI Pn U …
PP Preceding Page
PPA Page Position Absolute
PPB Page Position Backward
PPR Page Position Forward
REP Repeat CSI Pn b …
RM Reset Mode CSI Pm l …
SD Scroll Down CSI Pn T …
SGR Select Graphic Rendition CSI Pm m …
SIMD Select Implicit Movement Direction CSI Ps ^ …
SL Scroll Left CSI Pn SP @ …
SM Set Mode CSI Pm h …
SR Scroll Right
SU Scroll Up CSI Pn S …
TBC Tabulation Clear CSI Ps g …
VPA Line Position Absolute CSI Pn d …
VPB Line Position Backward CSI Pn k …
VPR Line Position Forward CSI Pn e …
XTCHECKSUM Select Checksum Extension
XTMODKEYS Set Key Modifier Options CSI > Pp ; Pv m …
XTQMODKEYS Query Key Modifier Options
XTRESTORE Restore DEC Private Mode Values CSI ? Pm r …
XTSAVE Save DEC Private Mode Values CSI ? Pm s …
XTVERSION Report Version CSI > Ps q …
XTWINOPS Window Operations CSI Ps ; Ps ; Ps t …
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.