^[control-codes
live in libghostty-vt

Escape sequences

DECKPAM, DECKPNM Keypad Application and Numeric Modes

View as Markdown

Choose what the numeric keypad sends: its digits or application codes.

DECKPAM Keypad Application Mode

ESC =
DEC STD 070
§6.9 Set Keypad Application Mode, p. 6-66
VT220
§4.6.18 Keypad Mode (DECKPAM/DECKPNM)
VT510
DECKPAM—Keypad Application Mode

ESC = (DECKPAM) puts the numeric keypad into application mode, and ESC > (DECKPNM) puts it back into numeric mode, the default. In numeric mode the keypad’s keys send the digits, comma, period and minus sign printed on them. In application mode they send SS3 followed by a single character identifying the key.

DECKPNM is defined in DEC STD 070 §6.9, p. 6-67 and in the VT510 manual as DECKPNM—Keypad Numeric Mode.

The same setting is DEC private mode 66, DECNKM: CSI ? 66 h is the same as DECKPAM, and CSI ? 66 l the same as DECKPNM. DEC STD 070 (§6.9, p. 6-68) says it was added to make it simpler to ask for the keypad’s state; the VT510 manual has it as DECNKM. DEC STD 070 requires, from level 2, that this mode and the cursor key mode (DECCKM) be independent of each other.

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

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Partly§4.6.18 Keypad Mode (DECKPAM/DECKPNM); no DECNKM, mode 66
VT510manual, 1st ed., 1993YesDECKPAM, DECKPNM, DECNKM
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yes
kitty0.49.1, run in a VMNofails the 4 cases that show it working
foot1.28.0, run in a VMYespasses the 4 cases that show it working
xterm.js headless6.0.0, run as a libraryYespasses the 4 cases that show it working
alacritty_terminal0.26.0, run as a libraryNofails the 4 cases that show it working
ConEmubuild 230724, its documentationNolists DECCKM but not DECKPAM, DECKPNM or mode 66, in ANSI escape codes
rxvt-unicode9.31, run in a VMYespasses the 4 cases that show it working
VTE0.84.1, run as a libraryYespasses the 4 cases that show it working

Validation

DECKPAM-1: Application mode

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

DECKPAM-2: Back to numeric mode

\e=
\e>
\e[?66$p
|_____|
reply \e[?66;2$y

DECKPAM-3: The same setting as mode 66

\e[?66h   # DECNKM, set
\e[?66$p
\e[?66l   # DECNKM, reset
\e[?66$p
|_____|
reply \e[?66;1$y\e[?66;2$y

DECKPAM-4: Numeric mode to begin with

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