[fpc-pascal]Problem reading "Pos1" and "End" Keys with Linux

Ken J. Wright ken at cncware.com
Mon May 7 19:33:07 CEST 2001

> After trying my wits with the CRT NCRT and OCRT units, I
> still can not read the "Pos1" or "End" Keys from the
> Terminal. All other Keys return single or double Codes just
> like the old dos Terminal would with TP.
> For example the "Pos1" key returns a sequence of "#27 '[' #72"
> instead of the the normal "#0 #71"
> Does someone know a way to get this to work right.

Hi Stefan,

I'm still a bit confused as to what terminal/keyboard you are using.

> BTW: SuSE Linux 6.4 with KDE Terminal

Do you mean using KDE's konsole in an X session? I don't recall what keyboard 
has a Pos1 key.

The curses library returns long integer value for all keypress combinations, 
so the ncrt unit translates these into character values that readkey expects. 
Also ncurses handle #27 in a special way. If a keypress produces #27 followed 
immediately with a sequence of keys that it knows from termcap or terminfo, 
then this is treated as a combination and returned as a single integer value. 
The actual key sequence is not seen by readkey. ncrt translates a known list 
of possible values and drops the unknowns. This is probably what happens to 
your Pos1 key.


More information about the fpc-pascal mailing list