TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mark Kimes
from: Jon Guthrie
date: 1995-03-22 18:24:34
subject: ASYNC help

15 Mar 95, Mark Kimes writes to Jon Guthrie:

 >> Among other effects,
 >> I wanted to be able to allow the user to type in escape sequences
 >> (like the ^[[A that most terminal programs transmit when you hit
 >> the up-arrow key) and still recognize single escape characters.

 > It's not necessary to do a timeout for this sort of thing -- who cares
 > whether the user's terminal sent it or the user force-typed it (with
 > some terminals you can't tell the difference)?  To recognize single
 > escape characters, simply look for ^[ NOT followed immediately by [.

That won't work unless you have some sort of timeout.  After all, if you wait
for the character following the escape character in order to determine
whether it's a single escape or part of a sequence, you might have to wait
a long time.

 > For my own code, I use the following method -- get a character, if it's
 > ^[, peek (no waiting) the next character; if it's [, process balance as
 > an escape sequence, else process ^[ and continue.  Hasn't ever failed.


- Jon

--- GoldED/2 2.42.G0214
* Origin: The Wandering Programmer Comes Home (1:106/2000.25)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 30883/25 106/2000 449 116 170/400 270/101 105/103 42 712/515 711/808
@PATH: 711/809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.