Re: RDS! ed in FreeBSD

new topic     » goto parent     » topic index » view thread      » older message » newer message

C. K. Lester wrote:

>
> Robert Craig wrote:
>
>> C. K. Lester wrote:
>>
>>> Rob, I've found the problem.
>>>
>>> ed.ex uses wait_key() to get user input.
>>> key.ex uses get_key() to get user input.
>>>
>>> get_key() returns the right keycode. wait_key() returns something else.
>>>
>>> When I substitute "wait_key()" for "get_key()" in key.ex, I get THREE
>>> codes output. For instance, when get_key() receives an up arrow, it
>>> outputs 259. When wait_key() receives an up arrow, I get 27, 79, 65, 
>>> all
>>> one after the other.
>>
>>
>> Some systems generate a series of 3 codes for certain special
>> keys. The function next_key() in ed.ex has the logic for
>> handling single or triple key codes, but it doesn't expect
>> the arrow keys to come through as triples. I guess you'll have
>> to modify next_key() to detect when the sets of three codes
>> that represent arrow keys come through.
>> Right now it only handles Home and End. It looks
>> for 27 then 79, then 0 for Home or 101 for End. You'll have
>> to add elsif's for 65 and and the other keys.
>>
>> Maybe you can trace ed.ex and see what it does
>> when you hit an arrow key. 
>
>
> You mean you don't know?! It's your program! :)
>
> Okay, the arrow keys also return the 27 then 79 then a special number, 
> so that should be easy to modify. However, I tested out the CTRL+Home 
> and CTRL+End (keystrokes which I must have) and they have FIVE 
> returned numbers! whew.

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?!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu