Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Capturing Arrow Keys Input

by jakobi (Pilgrim)
on Sep 30, 2009 at 00:02 UTC ( [id://798218]=note: print w/replies, xml ) Need Help??


in reply to Capturing Arrow Keys Input

Unix side of things:

Welcome, you just found a nest of killer-bees in your way:)

Very Short Version:

There are no arrow keys (sensu key code in terminal windows). Use cat -vet to know what sequence to expect for a key.

Moderately Short Version:

On a Unix box, check man termcap, terminfo, maybe also stty, tput, setterm, and possibly curses (there are a number of perl modules as well, incl. for curses use; but I think you should stop well before curses unless you really need it). Termcap and terminfo make sense of the TERM variable (often one of xterm or vt100) and translate that to the actual capabilities to expect from the terminal (/pty/tty; if not avoidable: read up on the master/slave side of ptys as well; also raw, cooked, cbreak; the notions of process groups and controlling ttys).

This page from the docs of the rxvt-unicode X graphical terminal emulator http://pwet.fr/man/linux/conventions/urxvt might serve to give you some impression of terminal apps and the (historical) esc-codes controllig their use, going back all the way to the use of the earliest typewriters as terminals on mini computers (and most of that cruft is still retained).

Which keys to expect: how about cat -vet in a shell window. Note that for X, there was a change, so rxvt (and vt100/screen I think?) tend to use the older style, xterm provides the newer cursor/function key codes

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://798218]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found