The terminal emulation software escape key sequence does not match the UNIX TERMINFO escape sequence.
How do you identify the escape key sequence to use in a TERMINFO file for a particular key depression like F2 or shift F2 etc…
Here is a program scanwinput.c to display the escape sequences received by a UNIX system, which can be used to update your TERMINFO files.
Getting this output is a good step to solving the complex issue of terminal configuration on UNIX platforms.
lines <25> columns <70> termname
longname xterm terminal emulator (X Window System)
Enter a string or key sequence like ctrl-f4 to see hex values or q exit
You Entered : ^[OQ
You entered in hex : 1b4f51
Press any key to continue :
scanwinput.c will show all available options for the TERMINFO file in use.
str ked key_eos = ABSENT_STRING
str kf0 key_f0 = ABSENT_STRING
str kf1 key_f1 = \EOP
str kf10 key_f10 = \E[21~
str kf2 key_f2 = \EOQ
str kf3 key_f3 = \EOR
The above shows that kf2 is ”\E” escape x’1b’ and “OQ” which is what we got when we pressed the F2 key so good match.
We can expand a mftic generated TERMINFO file using mfinfocmp to see the TERMINFO source
mfinfocmp -1 | grep kf2=
Change the output from mfinfocmp and put it back in the TERMINFO database using mftic.
To download the c source code, click the link and save as < scanwinput.c >
To compile on UNIX
cob -xv scanwinput.c -lcurses -o scanwinput
This is just a starting point for solving TERMINFO problems.