Supported Terminal Sequences

xterm.js version: 5.5.0

Table of Contents

General notes

This document lists xterm.js’ support of terminal sequences. The sequences are grouped by their sequence type:

  • C0: single byte command (7bit control codes, byte range \x00 .. \x1F, \x7F)
  • C1: single byte command (8bit control codes, byte range \x80 .. \x9F)
  • ESC: sequence starting with ESC (\x1B)
  • CSI - Control Sequence Introducer: sequence starting with ESC [ (7bit) or CSI (\x9B, 8bit)
  • DCS - Device Control String: sequence starting with ESC P (7bit) or DCS (\x90, 8bit)
  • OSC - Operating System Command: sequence starting with ESC ] (7bit) or OSC (\x9D, 8bit)

Application Program Command (APC), Privacy Message (PM) and Start of String (SOS) are recognized but not supported, any sequence of these types will be silently ignored. They are also not hookable by the API.

Note that the list only marks sequences implemented in xterm.js’ core codebase as supported. Missing sequences are either not supported or unstable/experimental. Furthermore addons or integrations can provide additional custom sequences (denoted as “External” where known).

To denote the sequences the tables use the same abbreviations as xterm does:

  • Ps: A single (usually optional) numeric parameter, composed of one or more decimal digits.
  • Pm: Multiple numeric parameters composed of any number of single numeric parameters, separated by ; character(s), e.g. ` Ps ; Ps ; … `.
  • Pt: A text parameter composed of printable characters. Note that for most commands with Pt only ASCII printables are specified to work. Additionally the parser will let pass any codepoint greater than C1 as printable.

C0

Mnemonic Name Sequence Short Description Support
NUL Null \0, \x00 NUL is ignored.
BEL Bell \a, \x07 Ring the bell. more
BS Backspace \b, \x08 Move the cursor one position to the left. more
HT Horizontal Tabulation \t, \x09 Move the cursor to the next character tab stop.
LF Line Feed \n, \x0A Move the cursor one row down, scrolling if needed. more
VT Vertical Tabulation \v, \x0B Treated as LF.
FF Form Feed \f, \x0C Treated as LF.
CR Carriage Return \r, \x0D Move the cursor to the beginning of the row.
SO Shift Out \x0E Switch to an alternative character set. Partial
SI Shift In \x0F Return to regular character set after Shift Out.
ESC Escape \e, \x1B Start of a sequence. Cancels any other sequence.

C1

Mnemonic Name Sequence Short Description Support
IND Index \x84 Move the cursor one line down scrolling if needed.
NEL Next Line \x85 Move the cursor to the beginning of the next row.
HTS Horizontal Tabulation Set \x88 Places a tab stop at the current cursor position.
DCS Device Control String \x90 Start of a DCS sequence.
CSI Control Sequence Introducer \x9B Start of a CSI sequence.
ST String Terminator \x9C Terminator used for string type sequences.
OSC Operating System Command \x9D Start of an OSC sequence.
PM Privacy Message \x9E Start of a privacy message.
APC Application Program Command \x9F Start of an APC sequence.

CSI

Mnemonic Name Sequence Short Description Support
ICH Insert Characters CSI Ps @ Insert Ps (blank) characters (default = 1). more
SL Scroll Left CSI Ps SP @ Scroll viewport Ps times to the left. more
CUU Cursor Up CSI Ps A Move cursor Ps times up (default=1). more
SR Scroll Right CSI Ps SP A Scroll viewport Ps times to the right. more
CUD Cursor Down CSI Ps B Move cursor Ps times down (default=1). more
CUF Cursor Forward CSI Ps C Move cursor Ps times forward (default=1).
CUB Cursor Backward CSI Ps D Move cursor Ps times backward (default=1).
CNL Cursor Next Line CSI Ps E Move cursor Ps times down (default=1) and to the first column. more
CPL Cursor Backward CSI Ps F Move cursor Ps times up (default=1) and to the first column. more
CHA Cursor Horizontal Absolute CSI Ps G Move cursor to Ps-th column of the active row (default=1).
CUP Cursor Position CSI Ps ; Ps H Set cursor to position [Ps, Ps] (default = [1, 1]). more
CHT Cursor Horizontal Tabulation CSI Ps I Move cursor Ps times tabs forward (default=1).
ED Erase In Display CSI Ps J Erase various parts of the viewport. more
DECSED Selective Erase In Display CSI ? Ps J Same as ED with respecting protection flag.
EL Erase In Line CSI Ps K Erase various parts of the active row. more
DECSEL Selective Erase In Line CSI ? Ps K Same as EL with respecting protecting flag.
IL Insert Line CSI Ps L Insert Ps blank lines at active row (default=1). more
DL Delete Line CSI Ps M Delete Ps lines at active row (default=1). more
DCH Delete Character CSI Ps P Delete Ps characters (default=1). more
SU Scroll Up CSI Ps S Scroll Ps lines up (default=1).
SD Scroll Down CSI Ps T Scroll Ps lines down (default=1).
ECH Erase Character CSI Ps X Erase Ps characters from current cursor position to the right (default=1). more
CBT Cursor Backward Tabulation CSI Ps Z Move cursor Ps tabs backward (default=1).
HPA Horizontal Position Absolute CSI Ps ` Same as CHA.
HPR Horizontal Position Relative CSI Ps a Same as CUF.
REP Repeat Preceding Character CSI Ps b Repeat preceding character Ps times (default=1). more
DA1 Primary Device Attributes CSI c Send primary device attributes.
DA2 Secondary Device Attributes CSI > c Send primary device attributes.
VPA Vertical Position Absolute CSI Ps d Move cursor to Ps-th row (default=1).
VPR Vertical Position Relative CSI Ps e Move cursor Ps times down (default=1).
HVP Horizontal and Vertical Position CSI Ps ; Ps f Same as CUP.
TBC Tab Clear CSI Ps g Clear tab stops at current position (0) or all (3) (default=0). more
SM Set Mode CSI Pm h Set various terminal modes. more Partial
DECSET DEC Private Set Mode CSI ? Pm h Set various terminal attributes. more Partial
RM Reset Mode CSI Pm l Set various terminal attributes. more Partial
DECRST DEC Private Reset Mode CSI ? Pm l Reset various terminal attributes. more Partial
SGR Select Graphic Rendition CSI Pm m Set/Reset various text attributes. more Partial
DSR Device Status Report CSI Ps n Request cursor position (CPR) with Ps = 6.
DECDSR DEC Device Status Report CSI ? Ps n Only CPR is supported (same as DSR). Partial
DECRQM Request Mode CSI Ps $p Request mode state. more
DECSTR Soft Terminal Reset CSI ! p Reset several terminal attributes to initial state. more
DECSCA Select Character Protection Attribute CSI Ps " q Whether DECSED and DECSEL can erase (0=default, 2) or not (1).
DECSCUSR Set Cursor Style CSI Ps SP q Set cursor style. more
DECSTBM Set Top and Bottom Margin CSI Ps ; Ps r Set top and bottom margins of the viewport [top;bottom] (default = viewport size).
SCOSC Save Cursor CSI s Save cursor position, charmap and text attributes. Partial
SCORC Restore Cursor CSI u Restore cursor position, charmap and text attributes. Partial
DECIC Insert Columns CSI Ps ' } Insert Ps columns at cursor position. more
DECDC Delete Columns CSI Ps ' ~ Delete Ps columns at cursor position. more

DCS

Mnemonic Name Sequence Short Description Support
SIXEL SIXEL Graphics DCS Ps ; Ps ; Ps ; q Pt ST Draw SIXEL image. External
DECUDK User Defined Keys DCS Ps ; Ps \| Pt ST Definitions for user-defined keys.
XTGETTCAP Request Terminfo String DCS + q Pt ST Request Terminfo String.
XTSETTCAP Set Terminfo Data DCS + p Pt ST Set Terminfo Data.
DECRQSS Request Selection or Setting DCS $ q Pt ST Request several terminal settings. more Partial

ESC

Mnemonic Name Sequence Short Description Support
SC Save Cursor ESC 7 Save cursor position, charmap and text attributes.
RC Restore Cursor ESC 8 Restore cursor position, charmap and text attributes.
DECALN Screen Alignment Pattern ESC # 8 Fill viewport with a test pattern (E).
IND Index ESC D Move the cursor one line down scrolling if needed.
NEL Next Line ESC E Move the cursor to the beginning of the next row.
HTS Horizontal Tabulation Set ESC H Places a tab stop at the current cursor position.
IR Reverse Index ESC M Move the cursor one line up scrolling if needed.
DCS Device Control String ESC P Start of a DCS sequence.
CSI Control Sequence Introducer ESC [ Start of a CSI sequence.
ST String Terminator ESC \ Terminator used for string type sequences.
OSC Operating System Command ESC ] Start of an OSC sequence.
PM Privacy Message ESC ^ Start of a privacy message.
APC Application Program Command ESC _ Start of an APC sequence.

OSC

Note: Other than listed in the table, the parser recognizes both ST (ECMA-48) and BEL (xterm) as OSC sequence finalizer.

Identifier Sequence Short Description Support
0 OSC 0 ; Pt BEL Set window title and icon name. more Partial
1 OSC 1 ; Pt BEL Set icon name.
2 OSC 2 ; Pt BEL Set window title. more
4 OSC 4 ; c ; spec BEL Change color number c to the color specified by spec. more
8 OSC 8 ; params ; uri BEL Create a hyperlink to uri using params. more
10 OSC 10 ; Pt BEL Set or query default foreground color. more
11 OSC 11 ; Pt BEL Same as OSC 10, but for default background.
12 OSC 12 ; Pt BEL Same as OSC 10, but for default cursor color.
104 OSC 104 ; c BEL Reset color number c to themed color. more
110 OSC 110 BEL Restore default foreground to themed color.
111 OSC 111 BEL Restore default background to themed color.
112 OSC 112 BEL Restore default cursor to themed color.