Re: RDS! ed in FreeBSD
- Posted by Robert Craig <rds at RapidEuphoria.com> Oct 16, 2003
- 462 views
C. K. Lester wrote: > Well, it's turning out to be different than I expected. I thought a few > more "elsif"s would work, but it's not working. Plus, the HOME and END > keys don't function properly. > > For example, when I press my up arrow, I get the top-line prompt and > "0A" is printed at the prompt. That's the second and third number of the > sequence returned by wait_key(). So why is ed.ex not responding to it?! For you, up-arrow generates 27 79 65 It's as if you had typed: Esc 'O' 'A' Esc causes the top command line on ed to appear, and then the next two codes are taken as OA So how did this possibly work for me? At first I thought I would have to choose another key to perform the function of the Esc key, but then I found that if I manually typed Esc, wait_key/get_key would see Esc followed by -1 -1 -1 ... until I hit another key. That tips off next_key() that a human actually typed Esc. If a special key is pressed, wait_key/get_key will see all three (or five!) codes consecutively in the input, before seeing any -1. ed can see it's an escape sequence for a special key. Maybe on your machine, the escape sequence stream, as seen by wait_key/get_key, has -1 after Esc so ed thinks you actually typed Esc followed by O and A. On some other system a long time ago I noticed a tiny fraction of a second delay whenever I typed Esc. It's as if the system was waiting to see if more codes were coming before concluding it was a real Esc key. You might have to choose another key to perform the function of Esc, or maybe you need to allow for a couple of -1's between escape sequence codes. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com