1

terminfo database contains entries, describing "application mode". By convention, entries which correspond to buttons, pressed on keyboard, start with \EO (this is done so that applications which do not perform initialization will know in which mode terminal is initialized by default - "normal" or "application") and are named with k prefix. But for example, on Debian 10 ( /lib/terminfo/x/xterm-256color) this is not true:

$ infocmp -1|grep 'kf[0-9]='
kf1=\EOP,
kf2=\EOQ,
kf3=\EOR,
kf4=\EOS,
kf5=\E[15~,
kf6=\E[17~,
kf7=\E[18~,
kf8=\E[19~,
kf9=\E[20~,

Is this a bug in terminfo database?

  • What convention are you referring to? There's no convention that function key escape sequences start with \EO. \E[ is a very common prefix, \EO is a bit of a legacy one. – Gilles Aug 10 '17 at 22:17
  • @Gilles I'm referring to this answer unix.stackexchange.com/a/383087/143661 – Igor Liferenko Aug 10 '17 at 22:45
3

That's a broad topic...

Most (not all) terminals are configurable, with the ones you're familiar with responding to control sequences which provide application modes for the cursor, editing and numeric keypad keys. You may notice that I didn't list function keys.

The terminfo database describes a particular configuration of the terminal.

Your example shows a configuration used for xterm to provide a VT100-style numeric keypad. The typical PC keyboard hasn't enough keys to match the VT100 keypad (because although it has 4 keys in the "right" place, NumLock is treated specially), and (since VT100s never had function keys), it was convenient to assign that top row to the first 4 PC function keys.

With xterm, that's configurable anyway, but as noted, terminfo entries describe a particular configuration.

You'll find that configuration copied by terminal emulators which don't actually provide a VT100-compatible numeric keypad, just to imitate xterm.

That's summarized in the xterm FAQ (for other terminals, typically it isn't documented at all):

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.