Terminfo smkx and Application Cursor Keys vs Application keypad
Asked Answered
E

2

6

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?

Electron answered 17/1, 2014 at 0:15 Comment(0)
P
4

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.

Phantasy answered 21/1, 2014 at 23:22 Comment(1)
I don't know why DECCKM appears in front of it, though.Phantasy
M
8

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):

  • numeric keypad (on the extreme right of a PC keyboard)
  • editing keypad (6 keys between the main keyboard and the numeric keyboard)
  • cursor keys
  • function keys (commonly at the top of a PC keyboard)

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.

Majestic answered 2/4, 2015 at 9:1 Comment(0)
P
4

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.

Phantasy answered 21/1, 2014 at 23:22 Comment(1)
I don't know why DECCKM appears in front of it, though.Phantasy

© 2022 - 2024 — McMap. All rights reserved.