DECKPAM, DECKPNM Keypad Application and Numeric Modes
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
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | Partly | §4.6.18 Keypad Mode (DECKPAM/DECKPNM); no DECNKM, mode 66 |
| VT510 | manual, 1st ed., 1993 | Yes | DECKPAM, DECKPNM, DECNKM |
| xterm | patch 412, xterm-411a | Yes | |
| libghostty-vt | 0f171f6 | Yes | |
| kitty | 0.49.1, run in a VM | No | fails the 4 cases that show it working |
| foot | 1.28.0, run in a VM | Yes | passes the 4 cases that show it working |
| xterm.js headless | 6.0.0, run as a library | Yes | passes the 4 cases that show it working |
| alacritty_terminal | 0.26.0, run as a library | No | fails the 4 cases that show it working |
| ConEmu | build 230724, its documentation | No | lists DECCKM but not DECKPAM, DECKPNM or mode 66, in ANSI escape codes |
| rxvt-unicode | 9.31, run in a VM | Yes | passes the 4 cases that show it working |
| VTE | 0.84.1, run as a library | Yes | passes 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