On 2017-10-07 08:35, Steve D'Aprano <steve+pyt...@pearwood.info> wrote:
> Unfortunately ESCAPE is already used. VT100 (the terminal emulation which is
> used in just about all terminals) all control sequences begin with ESC. So
> every time you do something like press an arrow key, the terminal sends ESC
> followed by other stuff. It would be painful if every time you hit an arrow
> key, the interpreter took it as "Exit".

The usual solution to this problem is to use a timeout: If ESC is not
followed by another character which could continue the sequence within
e.g. 0.1 seconds it is interpreted as a standalone key press instead of
the start of an escape sequence. This is not 100% reliable: If you are
on a jittery network connection, the O in the cursor-up sequence might
arrive more than 0.1 seconds after the ESC - or the the three distinct
keystrokes ESC O A might be delivered in the same packet.

        hp


-- 
   _  | Peter J. Holzer    | Fluch der elektronischen Textverarbeitung:
|_|_) |                    | Man feilt solange an seinen Text um, bis
| |   | h...@hjp.at         | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaƟt. -- Ralph Babel
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to