XTerm Control Sequences specifies the following key sequences:
CSI ? 1 h → Application Cursor Keys (DECCKM)
CSI ? 1 l → Normal Cursor Mode (DECOM)
CSI ? 66 h → Application keypad (DECNKM)
CSI ? 66 l → Numeric keypad (DECNKM)
and the Terminfo Source Format has the following entry:
Variable: keypad_xmit
Capname: smkx
Termcap: ks
Description: Put terminal in "keypad-transmit" mode
But the terminfo for xterm actually says smkx=\E[?1h\E=
, which seems mixed up to me (smkx should affect the keypad, not the cursor keys, right?). What am I missing here?
The line
CSI ? 1 h → Normal Cursor Mode (DECOM)
probably should read
CSI ? 1 l → Normal Cursor Keys (DECCKM)
There are two escape sequences in each of smkx
and rmkx
because these capabilities are used in curses, i.e., for the keypad
function.
The manual page for ncurses (like others) does not say so explicitly, but the function applies to all of the special keys on the keyboard which have the ability to switch between normal and application mode. This is a well-known feature of smkx
and rmkx
, as for example in the xterm FAQ Why can't I use the cursor keys in (whatever) shell?.
Special keys on the keyboard may include these (depending on the type of terminal):
The VT100 (which does not have function keys or editing keypad) has separate escape sequences for the other two categories. In VT220 (emulated by xterm), the editing keypad's normal/application mode is an extension of the VT100 DECCKM, (documented in XTerm Control Sequences). DEC did not define a corresponding feature for function keys; however if there were some terminal which supported this capability it would probably be used in smkx
and rmkx
.
It looks like you are missing the \E=
at the end of smkx
.
ESC = Application Keypad (DECKPAM).
ESC > Normal Keypad (DECKPNM).
are listed on the XTerm Control Sequences page as well and you would expect them to affect the keypad.
I found a related question here: keyboard transmit mode in vt100 terminal emulator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With