Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-05

Problem reading "Pos1" and "End" Keys with Linux

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Stefan Becker

dear Pascal list,

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.

BTW: SuSE Linux 6.4 with KDE Terminal

my thanks,
Stefan Becker

LUFA Speyer (EDV)
email:
tel : +49 (0)6232-629542
fax : +49 (0)6232-629544
http://www.lufa-speyer.de/

Ken J. Wright
to Stefan Becker
Show quoted text 9 lines
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.

Ken

Marco van de Voort
to Ken J. Wright
Show quoted text 6 lines
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.

E.g. German keyboards, on the spot of the "home" key.

Ken J. Wright
to Marco van de Voort
you wrote 8 lines
> 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. E.g. German keyboards, on the spot of the "home" key.

Wouldn't the keycodes be the same then? Is this just an xterm key mapping problem?

Stefan Becker
to Ken J. Wright: I'm still a bit confused as to what terminal/keyboard you are using. Do you mean using…

Hi again,
thanks for all your input. I'm sorry if my question seems to be confusing. I am having dificulty in explaining just what is not working correctly as well as pin pointing the problem.

take this programm for example:
------------------------------------------------------- program keys;
uses
nCrt;

var
ch:char;
lc:char;
begin
WriteLn('Exit with 2 x ESC');
ch:=#0;
lc:=#0;
 repeat
  while not keypressed do;
   lc:=ch;
   ch:=ReadKey;
  if ch=#0 then
  begin
   Write('#0 - ');
    lc:=ch;
    ch:=ReadKey;
    Write(ord(ch));
  end else
  begin
   Write(ord(ch),' = ');
   if ch<#32 then Write(ord(ch)) else Write('",ch,"');
  end;
 WriteLn;
 until ((ch=#27) and (lc=#27));
end.

----------------------------------------------------------

Whatever console I use to -
- putty with windows to the linux server
- ssh from a differant machine to the linux server
- windows NT telnet to the linux server
- KDE's console

The results are that some keys do not return any results. or like I said the KDE-console and Putty-SSH returns: <ESC>,'[','H' sequenz for the "Home" Key on the keyboard <ESC>,'[','F' sequenz for the "End " Key on the keyboard

Only if I'm on the Servers console (directly on the linux machine) does the function return the results for the <home> & <end> keys just as Borland and DOS would.

Does this mean that the problem is within the termcap intepretation of the consoles' dialog? If yes, where is "termcap" explained?

my regards and happy programming,
Stefan

Jeff Wormsley
to Stefan Becker
PM Stefan Becker wrote
The results are that some keys do not return any results. or like I said the KDE-console and Putty-SSH returns: <ESC>,'[','H' sequenz for the "Home" Key on the keyboard <ESC>,'[','F' sequenz for the "End " Key on the keyboard

These look like VT100 escape sequences, which would be expected for a termcap'ed interface, rather than a direct keyboard read.

Jeff.