1. RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 15, 2003
- 484 views
Rob, When I try to run ed in FreeBSD, I can't seem to use my arrow keys. They take me straight to the menu. What's up with that? :) -ck
2. Re: RDS! ed in FreeBSD
- Posted by Robert Craig <rds at RapidEuphoria.com> Oct 15, 2003
- 461 views
C. K. Lester wrote: > When I try to run ed in FreeBSD, I can't seem to use my arrow keys. They > take me straight to the menu. What's up with that? :) On Linux or FreeBSD you'll find that some of the special keys don't work, or they produce a different key code than what ed is expecting. Each Linux/FreeBSD system seems to be a bit different, especially if you use Telnet. You should run exu euphoria/bin/key.ex and make a note of the key codes for any keys you want to use. Then you have to make a few changes to the keycodes assumed for platform LINUX near the top of ed.ex. You might even have to invent a new code, e.g. use control-I (9) to replace "Insert", if that key doesn't work. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
3. Re: RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 16, 2003
- 487 views
Robert Craig wrote: > > C. K. Lester wrote: > >> When I try to run ed in FreeBSD, I can't seem to use my arrow keys. >> They take me straight to the menu. What's up with that? :) > > > On Linux or FreeBSD you'll find that some of the special > keys don't work, or they produce a different key code > than what ed is expecting. Each Linux/FreeBSD system > seems to be a bit different, especially if you use Telnet. > > You should run > exu euphoria/bin/key.ex > and make a note of the key codes for any keys > you want to use. Then you have to make a few changes > to the keycodes assumed for platform LINUX > near the top of ed.ex. The key codes I got from key.ex are the same that are already in ed.ex(!), namely left arrow = 260 up arrow = 259 right arrow = 261 down arrow = 258 What should I try?
4. Re: RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 16, 2003
- 473 views
Robert Craig wrote: > > C. K. Lester wrote: > >> When I try to run ed in FreeBSD, I can't seem to use my arrow keys. >> They take me straight to the menu. What's up with that? :) > > > On Linux or FreeBSD you'll find that some of the special > keys don't work, or they produce a different key code > than what ed is expecting. Each Linux/FreeBSD system > seems to be a bit different, especially if you use Telnet. Rob, here's a clue... When I run it outside of X, I get no problems... Inside X, however... Also, inside X, the key program returns the right key codes, so what is it about X that ed finds confusing and not key.ex?!
5. Re: RDS! ed in FreeBSD
- Posted by Ken Rhodes <ken_rhodes30436 at yahoo.com> Oct 16, 2003
- 467 views
just out of curiosity, CK, which terminal emulator are you using under X windows - konsole, gnome-terminal, xterm, etc. and which desktop and window manager? --- "C. K. Lester" <euphoric at cklester.com> wrote: > > > Robert Craig wrote: > > > > > C. K. Lester wrote: > > > >> When I try to run ed in FreeBSD, I can't seem to > use my arrow keys. > >> They take me straight to the menu. What's up with > that? :) > > > > > > On Linux or FreeBSD you'll find that some of the > special > > keys don't work, or they produce a different key > code > > than what ed is expecting. Each Linux/FreeBSD > system > > seems to be a bit different, especially if you use > Telnet. > > Rob, here's a clue... > > When I run it outside of X, I get no problems... > Inside X, however... > Also, inside X, the key program returns the right > key codes, so what is > it about X that ed finds confusing and not key.ex?! > > > > > TOPICA - Start your own email discussion group. > FREE! > > >
6. Re: RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 16, 2003
- 477 views
Ken Rhodes wrote: > > >just out of curiosity, CK, which terminal emulator are >you using under X windows - konsole, gnome-terminal, >xterm, etc. and which desktop and window manager? > > I don't know what terminal emulator I'm using! hmmmm. Found it: xfterm4. I'm using xfce4 as my window manager + desktop.
7. Re: RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 16, 2003
- 472 views
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. Help!!! :) Thanks, ck
8. Re: RDS! ed in FreeBSD
- Posted by Ken Rhodes <ken_rhodes30436 at yahoo.com> Oct 16, 2003
- 473 views
I'm running Linux, not FreeBSD, but I've found the gnome-terminal more amenable to adaptation to "ed's" code than any other that I have tried. I'm using XFCE too and I love it! Ken Rhodes --- "C. K. Lester" <euphoric at cklester.com> wrote: > > > Ken Rhodes wrote: > > > > >just out of curiosity, CK, which terminal emulator > are > >you using under X windows - konsole, > gnome-terminal, > >xterm, etc. and which desktop and window manager? > > > > > I don't know what terminal emulator I'm using! > hmmmm. Found it: xfterm4. > > I'm using xfce4 as my window manager + desktop. > > > > > TOPICA - Start your own email discussion group. > FREE! > > >
9. Re: RDS! ed in FreeBSD
- Posted by Robert Craig <rds at RapidEuphoria.com> Oct 16, 2003
- 480 views
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. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
10. Re: RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 16, 2003
- 456 views
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.
11. Re: RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 16, 2003
- 507 views
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?!
12. Re: RDS! ed in FreeBSD
- Posted by Chris Burch <chrisburch at uku.co.uk> Oct 16, 2003
- 486 views
--part1_43.2386c388.2cbfe434_boundary Hi C. K. Lester wrote: >You mean you don't know?! It's your program! :) I once said this to a lecturer when I was at university - I nearly failed the year! As an experiment, run xterm (everyone has an xterm!), and see if the same problems happen. If they do then you have an incorrect termcap file, and if they don't then the problem's with the terminal emulator. I think. Chris --part1_43.2386c388.2cbfe434_boundary Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable <HTML><FONT FACE=3Darial,helvetica><FONT SIZE=3D2 FAMILY=3D"SANSSERIF" FACE= =3D"Arial" LANG=3D"0">Hi<BR> <BR> C. K. Lester wrote:<BR> <BR> >You mean you don't know?! It's your program! :)<BR> <BR> I once said this to a lecturer when I was at university - I nearly failed th= e year!<BR> <BR> As an experiment, run xterm (everyone has an xterm!), and see if the same pr= oblems happen. If they do then you have an incorrect termcap file, and if th= ey don't then the problem's with the terminal emulator. I think.<BR> <BR> Chris<BR> <BR> --part1_43.2386c388.2cbfe434_boundary--
13. Re: RDS! ed in FreeBSD
- Posted by Sabal.Mike at notations.com Oct 16, 2003
- 476 views
You need to be especially careful of the TERM environment variable. In console mode on most Linux distros, TERM = linux; but in XWin, TERM = xterm. The OS uses the TERM variable to reference the /etc/termcap file in older *nix's, and the terminfo database in newer flavors. These files map the scan codes from the keyboard into the key codes the program sees. That's why programs that use those keys will work differently in different environments. Try changing the TERM variable for a session to see if you get better results. If you do, adjust your configuration files to make the change permanent. HTH, Mike >>> euphoric at cklester.com 10/15/2003 10:10:54 PM >>> Robert Craig wrote: > > C. K. Lester wrote: > >> When I try to run ed in FreeBSD, I can't seem to use my arrow keys. >> They take me straight to the menu. What's up with that? :) > > > On Linux or FreeBSD you'll find that some of the special > keys don't work, or they produce a different key code > than what ed is expecting. Each Linux/FreeBSD system > seems to be a bit different, especially if you use Telnet. Rob, here's a clue... When I run it outside of X, I get no problems... Inside X, however... Also, inside X, the key program returns the right key codes, so what is it about X that ed finds confusing and not key.ex?!
14. Re: RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 16, 2003
- 473 views
Chris Burch wrote: > > > Hi > > C. K. Lester wrote: > > >You mean you don't know?! It's your program! :) > > I once said this to a lecturer when I was at university - I nearly > failed the year! > > As an experiment, run xterm (everyone has an xterm!), and see if the > same problems happen. If they do then you have an incorrect termcap > file, and if they don't then the problem's with the terminal emulator. > I think. > I ran xterm and the problem occurs. I'll check out that termcap file.
15. Re: RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 16, 2003
- 466 views
Chris Burch wrote: > As an experiment, run xterm (everyone has an xterm!), and see if the > same problems happen. If they do then you have an incorrect termcap > file, and if they don't then the problem's with the terminal emulator. > I think. I ran xterm and the problem occurs. I'll check out that termcap file.
16. Re: RDS! ed in FreeBSD
- Posted by Robert Craig <rds at RapidEuphoria.com> Oct 16, 2003
- 461 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
17. Re: RDS! ed in FreeBSD
- Posted by "C. K. Lester" <euphoric at cklester.com> Oct 16, 2003
- 454 views
> C. K. Lester wrote: > > > > 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' I figured as much, but in the code you trap the first ESCAPE value (27) and check for the subseqeunt values. > 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. I don't see any -1 when i run key, using either get_key() or wait_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. So, after trapping ESCAPE, should I do something like while a[1] = -1 do a = a[2..length(a)] end while and strip those out first? Unfortunately, I'm at work right now, so this will have to wait 'til tonight. :)
18. Re: RDS! ed in FreeBSD
- Posted by Igor Kachan <kinz at peterlink.ru> Oct 16, 2003
- 476 views
Hello all interested in ed.ex improvements! Rob, CK, Ken and many others ... I have an idea, but I am too-too off-line of spare time now. ed.ex is very handy and good for the text mode. How about the pixel mode for ed.ex, edp.ex? Say, something like : --code of edp.ex include graphics.e -- old good lib for DOS include putsxy.e -- old good lib for DOS include ed.e -- new good lib for DOS with the global -- function editor(), which is just ed.ex -- with puts() replaced to putsxy() or such. if graphics_mode(261) then end if abort(editor ( X, -- of upper left corner of ed window Y, -- of upper left corner of ed window dX, -- width of ed window dY -- height of ed window ) ) -- end of code So, we can have a powerful ed-control for GUI, as just an EU function. Cool, no ?Regards, Igor Kachan kinz at peterlink.ru