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.
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.
✓
Bell
The behavior of the bell is further customizable with ITerminalOptions.bellStyle
and ITerminalOptions.bellSound.
Backspace
By default it is not possible to move the cursor past the leftmost position.
If reverse wrap-around (CSI ? 45 h) is set, a previous soft line wrap (DECAWM)
can be undone with BS within the scroll margins. In that case the cursor will wrap back
to the end of the previous row. Note that it is not possible to peek back into the scrollbuffer
with the cursor, thus at the home position (top-leftmost cell) this has no effect.
Line Feed
Scrolling is restricted to scroll margins and will only happen on the bottom line.
C1
Mnemonic
Name
Sequence
Short Description
Support
IND
Index
\x84
Move the cursor one line down scrolling if needed.
The ICH sequence inserts Ps blank characters. The cursor remains at the beginning of the
blank characters. Text between the cursor and right margin moves to the right. Characters moved
past the right margin are lost.
Scroll Left
SL moves the content of all lines within the scroll margins Ps times to the left.
SL has no effect outside of the scroll margins.
Cursor Up
If the cursor would pass the top scroll margin, it will stop there.
Scroll Right
SL moves the content of all lines within the scroll margins Ps times to the right.
Content at the right margin is lost.
SL has no effect outside of the scroll margins.
Cursor Down
If the cursor would pass the bottom scroll margin, it will stop there.
Cursor Next Line
Same as CUD, additionally places the cursor at the first column.
Cursor Backward
Same as CUU, additionally places the cursor at the first column.
Cursor Position
If ORIGIN mode is set, places the cursor to the absolute position within the scroll margins.
If ORIGIN mode is not set, places the cursor to the absolute position within the viewport.
Note that the coordinates are 1-based, thus the top left position starts at 1 ; 1.
Erase In Display
Supported param values:
Ps
Effect
0
Erase from the cursor through the end of the viewport.
1
Erase from the beginning of the viewport through the cursor.
2
Erase complete viewport.
3
Erase scrollback.
Erase In Line
Supported param values:
Ps
Effect
0
Erase from the cursor through the end of the row.
1
Erase from the beginning of the line through the cursor.
2
Erase complete line.
Insert Line
For every inserted line at the scroll top one line at the scroll bottom gets removed.
The cursor is set to the first column.
IL has no effect if the cursor is outside the scroll margins.
Delete Line
For every deleted line at the scroll top one blank line at the scroll bottom gets appended.
The cursor is set to the first column.
DL has no effect if the cursor is outside the scroll margins.
Delete Character
As characters are deleted, the remaining characters between the cursor and right margin move to
the left. Character attributes move with the characters. The terminal adds blank characters at
the right margin.
Erase Character
ED erases Ps characters from current cursor position to the right.
ED works inside or outside the scrolling margins.
Repeat Preceding Character
REP repeats the previous character Ps times advancing the cursor, also wrapping if DECAWM is
set. REP has no effect if the sequence does not follow a printable ASCII character
(NOOP for any other sequence in between or NON ASCII characters).
Tab Clear
Clearing tabstops off the active row (Ps = 2, VT100) is currently not supported.
Set Mode
Supported param values by SM:
Param
Action
Support
2
Keyboard Action Mode (KAM). Always on.
✗
4
Insert Mode (IRM).
✓
12
Send/receive (SRM). Always off.
✗
20
Automatic Newline (LNM).
✓
DEC Private Set Mode
Supported param values by DECSET:
param
Action
Support
1
Application Cursor Keys (DECCKM).
✓
2
Designate US-ASCII for character sets G0-G3 (DECANM).
✓
3
132 Column Mode (DECCOLM).
✓
6
Origin Mode (DECOM).
✓
7
Auto-wrap Mode (DECAWM).
✓
8
Auto-repeat Keys (DECARM). Always on.
✗
9
X10 xterm mouse protocol.
✓
12
Start Blinking Cursor.
✓
25
Show Cursor (DECTCEM).
✓
45
Reverse wrap-around.
✓
47
Use Alternate Screen Buffer.
✓
66
Application keypad (DECNKM).
✓
1000
X11 xterm mouse protocol.
✓
1002
Use Cell Motion Mouse Tracking.
✓
1003
Use All Motion Mouse Tracking.
✓
1004
Send FocusIn/FocusOut events
✓
1005
Enable UTF-8 Mouse Mode.
✗
1006
Enable SGR Mouse Mode.
✓
1015
Enable urxvt Mouse Mode.
✗
1016
Enable SGR-Pixels Mouse Mode.
✓
1047
Use Alternate Screen Buffer.
✓
1048
Save cursor as in DECSC.
✓
1049
Save cursor and switch to alternate buffer clearing it.
Partial
2004
Set bracketed paste mode.
✓
Reset Mode
Supported param values by RM:
Param
Action
Support
2
Keyboard Action Mode (KAM). Always on.
✗
4
Replace Mode (IRM). (default)
✓
12
Send/receive (SRM). Always off.
✗
20
Normal Linefeed (LNM).
✓
DEC Private Reset Mode
Supported param values by DECRST:
param
Action
Support
1
Normal Cursor Keys (DECCKM).
✓
2
Designate VT52 mode (DECANM).
✗
3
80 Column Mode (DECCOLM).
Broken
6
Normal Cursor Mode (DECOM).
✓
7
No Wraparound Mode (DECAWM).
✓
8
No Auto-repeat Keys (DECARM).
✗
9
Don’t send Mouse X & Y on button press.
✓
12
Stop Blinking Cursor.
✓
25
Hide Cursor (DECTCEM).
✓
45
No reverse wrap-around.
✓
47
Use Normal Screen Buffer.
✓
66
Numeric keypad (DECNKM).
✓
1000
Don’t send Mouse reports.
✓
1002
Don’t use Cell Motion Mouse Tracking.
✓
1003
Don’t use All Motion Mouse Tracking.
✓
1004
Don’t send FocusIn/FocusOut events.
✓
1005
Disable UTF-8 Mouse Mode.
✗
1006
Disable SGR Mouse Mode.
✓
1015
Disable urxvt Mouse Mode.
✗
1016
Disable SGR-Pixels Mouse Mode.
✓
1047
Use Normal Screen Buffer (clearing screen if in alt).
✓
1048
Restore cursor as in DECRC.
✓
1049
Use Normal Screen Buffer and restore cursor.
✓
2004
Reset bracketed paste mode.
✓
Select Graphic Rendition
SGR selects one or more character attributes at the same time. Multiple params (up to 32)
are applied in order from left to right. The changed attributes are applied to all new
characters received. If you move characters in the viewport by scrolling or any other means,
then the attributes move with the characters.
Supported param values by SGR:
Param
Meaning
Support
0
Normal (default). Resets any other preceding SGR.
✓
1
Bold. (also see options.drawBoldTextInBrightColors)
✓
2
Faint, decreased intensity.
✓
3
Italic.
✓
4
Underlined (see below for style support).
✓
5
Slowly blinking.
✗
6
Rapidly blinking.
✗
7
Inverse. Flips foreground and background color.
✓
8
Invisible (hidden).
✓
9
Crossed-out characters (strikethrough).
✓
21
Doubly underlined.
✓
22
Normal (neither bold nor faint).
✓
23
No italic.
✓
24
Not underlined.
✓
25
Steady (not blinking).
✓
27
Positive (not inverse).
✓
28
Visible (not hidden).
✓
29
Not Crossed-out (strikethrough).
✓
30
Foreground color: Black.
✓
31
Foreground color: Red.
✓
32
Foreground color: Green.
✓
33
Foreground color: Yellow.
✓
34
Foreground color: Blue.
✓
35
Foreground color: Magenta.
✓
36
Foreground color: Cyan.
✓
37
Foreground color: White.
✓
38
Foreground color: Extended color.
Partial
39
Foreground color: Default (original).
✓
40
Background color: Black.
✓
41
Background color: Red.
✓
42
Background color: Green.
✓
43
Background color: Yellow.
✓
44
Background color: Blue.
✓
45
Background color: Magenta.
✓
46
Background color: Cyan.
✓
47
Background color: White.
✓
48
Background color: Extended color.
Partial
49
Background color: Default (original).
✓
53
Overlined.
✓
55
Not Overlined.
✓
58
Underline color: Extended color.
Partial
90 - 97
Bright foreground color (analogous to 30 - 37).
✓
100 - 107
Bright background color (analogous to 40 - 47).
✓
Underline supports subparams to denote the style in the form 4 : x:
x
Meaning
Support
0
No underline. Same as SGR 24 m.
✓
1
Single underline. Same as SGR 4 m.
✓
2
Double underline.
✓
3
Curly underline.
✓
4
Dotted underline.
✓
5
Dashed underline.
✓
other
Single underline. Same as SGR 4 m.
✓
Extended colors are supported for foreground (Ps=38), background (Ps=48) and underline (Ps=58)
as follows:
Ps + 1
Meaning
Support
0
Implementation defined.
✗
1
Transparent.
✗
2
RGB color as Ps ; 2 ; R ; G ; B or Ps : 2 : : R : G : B.
✓
3
CMY color.
✗
4
CMYK color.
✗
5
Indexed (256 colors) as Ps ; 5 ; INDEX or Ps : 5 : INDEX.
✓
Request Mode
Returns a report as CSI Ps; Pm $ y (DECRPM), where Ps is the mode number as in SM/RM
or DECSET/DECRST, and Pm is the mode value:
0: not recognized
1: set
2: reset
3: permanently set
4: permanently reset
For modes not understood xterm.js always returns notRecognized. In general this means,
that a certain operation mode is not implemented and cannot be used.
Modes changing the active terminal buffer (47, 1047, 1049) are not subqueried
and only report, whether the alternate buffer is set.
Mouse encodings and mouse protocols are handled mutual exclusive,
thus only one of each of those can be set at a given time.
There is a chance, that some mode reports are not fully in line with xterm.js’ behavior,
e.g. if the default implementation already exposes a certain behavior. If you find
discrepancies in the mode reports, please file a bug.
Soft Terminal Reset
There are two terminal reset sequences - RIS and DECSTR. While RIS performs almost a full
terminal bootstrap, DECSTR only resets certain attributes. For most needs DECSTR should be
sufficient.
The following terminal attributes are reset to default values:
IRM is reset (dafault = false)
scroll margins are reset (default = viewport size)
erase attributes are reset to default
charsets are reset
DECSC data is reset to initial values
DECOM is reset to absolute mode
Set Cursor Style
Supported cursor styles:
empty, 0 or 1: steady block
2: blink block
3: steady underline
4: blink underline
5: steady bar
6: blink bar
Insert Columns
DECIC inserts Ps times blank columns at the cursor position for all lines with the scroll
margins, moving content to the right. Content at the right margin is lost. DECIC has no effect
outside the scrolling margins.
Delete Columns
DECDC deletes Ps times columns at the cursor position for all lines with the scroll margins,
moving content to the left. Blank columns are added at the right margin.
DECDC has no effect outside the scrolling margins.
Icon name is not supported. For Window Title see below.
Set Windows Title
xterm.js does not manipulate the title directly, instead exposes changes via the event
Terminal.onTitleChange.
Set ANSI color
c is the color index between 0 and 255. The color format of spec is derived from
XParseColor (see OSC 10 for supported formats). There may be multipe c ; spec pairs present
in the same instruction. If spec contains ? the terminal returns a sequence with the
currently set color.
Create hyperlink
uri is a hyperlink starting with http://, https://, ftp://, file:// or mailto://. params is an
optional list of key=value assignments, separated by the : character.
Example: id=xyz123:foo=bar:baz=quux.
Currently only the id key is defined. Cells that share the same ID and URI share hover
feedback. Use OSC 8 ; ; BEL to finish the current hyperlink.
Set or query default foreground color
To set the color, the following color specification formats are supported:
rgb:<red>/<green>/<blue> for <red>, <green>, <blue> in h | hh | hhh | hhhh, where
h is a single hexadecimal digit (case insignificant). The different widths scale
from 4 bit (h) to 16 bit (hhhh) and get converted to 8 bit (hh).
#RGB - 4 bits per channel, expanded to #R0G0B0
#RRGGBB - 8 bits per channel
#RRRGGGBBB - 12 bits per channel, truncated to #RRGGBB
#RRRRGGGGBBBB - 16 bits per channel, truncated to #RRGGBB
Note: X11 named colors are currently unsupported.
If Pt contains ? instead of a color specification, the terminal
returns a sequence with the current default foreground color
(use that sequence to restore the color after changes).
Note: Other than xterm, xterm.js does not support OSC 12 - 19.
Therefore stacking multiple Pt separated by ; only works for the first two entries.
Reset ANSI color
c is the color index between 0 and 255. This function restores the default color for c as
specified by the loaded theme. Any number of c parameters may be given.
If no parameters are given, the entire indexed color table will be reset.