terminfo, curses, application keypad ...

The VT100 Series terminals have cursor keys and a numeric keypad which can both operate in two different modes. The modes of the cursor keys can be set independently of the modes of the numeric keypad.

Modes of the cursor keys

The VT100 Series terminals have cursor ("arrows") keys which can operate in two different modes: Cursor Mode and Application Mode. "Cursor Mode" is the "reset" state, and is assumed to be the normal terminal state. "Application Mode" is the "set" state. In "Cursor Mode", the cursor keys transmit "Esc [ <code>" sequences, conforming to ANSI standards. In "Application Mode", the cursor keys transmit "Esc O <code>" sequences. "Application Mode" was provided on these terminals primarily as an aid to the porting of VT52 applications.

It is assumed that the cursor keys are normally in "Cursor Mode", and it is expected that applications such as editors will always transmit the "smkx" string (containing \E[?1h) to the terminal. Therefore, the definitions for the cursor keys match what the keys transmit in "Application Mode". It is also expected that applications will always transmit the "rmkx" string (containing \E[?1l) to the terminal before they exit, in order to reset the cursor keys to "Normal" mode.

Modes of the numeric keypad

The VT100 Series terminals have an auxilliary keypad, commonly referred to as the "Numeric Keypad", because it is a cluster of numeric and function keys. The Numeric Keypad can operate in two different modes: Numeric Mode and Application Mode. "Numeric Mode" is the "reset" state, and is assumed to be the normal terminal state. "Application Mode" is the "set" state. In "Numeric Mode", the keypad's numeric and punctuation keys transmit ASCII characters, and the <ENTER> key transmits the same as the <RETURN> key (Note: the <RETURN> key can be configured to send either LF (\012) or CR LF (\015 \012)). In "Application Mode", all the keypad keys transmit "Esc O <code>" sequences. The PF1 - PF4 keys always send the same "Esc O <code>" sequences, regardless of keypad mode.

It is assumed that the keypad is normally in "Numeric Mode", and it is expected that applications which require auxiliary keypad function keys will transmit the "smkx" string to the terminal. The "smkx" string must contain the control codes that switch the keypad into "Application Mode" (\E=), and the terminfo entry must also define the appropriate keypad function key "Application Mode" control codes. It is also expected that applications which transmit the "smkx" string will always transmit the "rmkx" string to the terminal before they exit. The "rmkx" string must contain \E> in order to reset the keypad to "Normal" mode.


Klaus Rohm <rohm@mpimf-heidelberg.mpg.de>, last update Jul 14, 1997