^[control-codes
live in libghostty-vt

Private modes

DECCKM Cursor Keys Mode

View as Markdown

Choose what the arrow keys send: cursor movement or application codes.

CSI ? 1 h/l
DEC STD 070
§6.8 Set/Reset Cursor Key Mode, p. 6-62
VT220
§4.6.8 Cursor Key Mode (DECCKM)
VT510
DECCKM—Cursor Keys Mode

CSI ? 1 h sets cursor keys mode to application and CSI ? 1 l resets it to cursor, the default. It changes what the four arrow keys send to the host. Reset, they send ANSI cursor movement sequences, ESC [ A for up. Set, they send application codes introduced by SS3 instead, ESC O A for up, similar to what the numeric keypad sends in application mode. DEC STD 070 tabulates both sets of codes in §6.8.2, p. 6-61.

DEC STD 070 requires, from level 2, that this mode and the keypad mode (DECKPAM) be independent of each other.

This site cannot press keys, so the cases check only the mode, through DECRQM, and that nothing on the screen changes.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Yes§4.6.8 Cursor Key Mode (DECCKM)
VT510manual, 1st ed., 1993YesDECCKM
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yes
kitty0.49.1, run in a VMYespasses the 3 cases that show it working
foot1.28.0, run in a VMYespasses the 3 cases that show it working
xterm.js headless6.0.0, run as a libraryYespasses the 3 cases that show it working
alacritty_terminal0.26.0, run as a libraryYespasses the 3 cases that show it working
ConEmubuild 230724, its documentationYesANSI escape codes
rxvt-unicode9.31, run in a VMYespasses the 3 cases that show it working
VTE0.84.1, run as a libraryYespasses the 3 cases that show it working

Validation

DECCKM-1: Set

\e[?1h
AB
\e[?1$p   # DECRQM: is mode 1 set?
|AB___|
reply \e[?1;1$y

DECCKM-2: Reset

\e[?1h
\e[?1l
\e[?1$p
|_____|
reply \e[?1;2$y

DECCKM-3: Cursor mode to begin with

\e[?1$p
|_____|
reply \e[?1;2$y
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.