Read this page in Portuguese
Read this page in Swedish
The Euphoria Editor
The Euphoria download package includes a handy, text-mode editor, ed, that's written completely in Euphoria. Many people find ed convenient for editing Euphoria programs and other files, but there is no requirement that you use it.
If you don't like ed, you have many alternatives. David Cuny's EE editor is a DOS-based editor for Euphoria that's also written in Euphoria. It has a friendly mouse-based user interface with drop down menus etc. It's available from the RDS Web site. There are several other Euphoria-oriented editors that run on DOS, Windows, Linux and FreeBSD. Check the Editors section of our Archive. In fact, any text editor can be used to edit a Euphoria program, including DOS Edit or Windows NotePad.
After any error, just type ed, and you'll be placed in the editor, at the line and column where the error was detected. The error message will be at the top of your screen.
Euphoria-related files are displayed in color. Other text files are in mono. You'll know that you have misspelled something when the color does not change as you expect. Keywords are blue. Names of routines that are built in to the interpreter appear in magenta. Strings are green, comments are red, most other text is black. Balanced brackets (on the same line) have the same color. You can change these colors as well as several other parameters of ed. See "user-modifiable parameters" near the top of ed.ex.
The arrow keys move the cursor left, right, up or down. Most other characters are immediately inserted into the file.
In Windows, you can "associate" various types of files with ed.bat. You will then be put into ed when you double-click on these types of files - e.g. .e, .pro, .doc etc. Main Euphoria files ending in .ex (.exw) might better be associated with ex.exe (exw.exe).
ed is a
multi-file/multi-window DOS editor.
Esc c will split your screen so you can view and edit up to 10 files
simultaneously, with cutting and pasting between them. You can also use
multiple edit windows to view and edit different parts of a single file.
Some PC keys do not work in a Linux or FreeBSD text console, or in Telnet, and some keys do not work in an xterm under X windows. Alternate keys have been provided. In some cases on Linux/FreeBSD you might have to edit ed.ex to map the desired key to the desired function.
Press and release the Esc key, then press one of the following keys:
The Esc n, Esc d, Esc r and Esc f commands prompt you to enter a string. You can recall and edit these strings just as you would at the DOS or Linux/FreeBSD command line. Type up-arrow or down-arrow to cycle through strings that you previously entered for a given command, then use left-arrow, right-arrow and the delete key to edit the strings. Press Enter to submit the string.
When you control-Delete (or control-D) a series of consecutive lines, or Delete a series of consecutive characters, you create a "kill-buffer" containing what you just deleted. This kill-buffer can be re-inserted by moving the cursor and then pressing Insert.
A new kill-buffer is started, and the old buffer is lost, each time you move away and start deleting somewhere else. For example, cut a series of lines with control-Delete. Then move the cursor to where you want to paste the lines and press Insert. If you want to copy the lines, without destroying the original text, first control-Delete them, then immediately press Insert to re-insert them. Then move somewhere else and press Insert to insert them again, as many times as you like. You can also Delete a series of individual characters, move the cursor, and then paste the deleted characters somewhere else. Immediately press Insert after deleting if you want to copy without removing the original characters.
Once you have a kill-buffer, you can type Esc n to read in a new file, or you can press an F-key to select a new edit window. You can then insert your kill-buffer.
The standard tab width is 8 spaces. The editor assumes tab=8 for most files. However, it is more convenient when editing a program for a tab to equal the amount of space that you like to indent. Therefore you will find that tabs are set to 4 when you edit Euphoria files (or .c, or .h or .bas files). The editor converts from tab=8 to tab=4 when reading your program file, and converts back to tab=8 when you save the file. Thus your file remains compatible with the tab=8 world, e.g. MS-DOS PRINT, EDIT, etc. If you would like to choose a different number of spaces to indent, change the line at the top of ed.ex that says "constant PROG_INDENT = 4".
Lines that extend beyond the right edge of the screen are marked with an inverse video character in the 80th column. This warns you that there is more text "out there" that you can't see. You can move the cursor beyond the 80th column. The screen will scroll left or right so the cursor position is always visible.
Like any Euphoria program, ed can access all the memory on your machine. It can edit huge files, and unless disk swapping occurs, most operations will be very fast.
ed is designed for editing pure text files, although you can use it to view other files. As ed reads in a file, it replaces certain non-printable characters (less than ASCII 14) with ASCII 254 - small square. If you try to save a non-text file you will be warned about this. (MS-DOS Edit will quietly corrupt a non-text file - do not save!). Since ed opens all files as "text" files, a control-z character (26) embedded in a file will appear to ed to be the end of the file.
Although ed is a DOS editor, you can edit existing files that have pathnames with long names in them, and the full file name will be preserved. However in this release ed will not create new files with long names. The name will be truncated to the standard DOS 8.3 length. (but see Platform below)
The end-of-line terminator on Linux/FreeBSD is simply \n. On DOS and Windows, text files have lines ending with \r\n. If you copy a DOS or Windows file to Linux/FreeBSD and try to modify it, ed will give you a choice of either keeping the \r\n terminators, or saving the file with \n terminators.
The complete source code to this editor is in bin\ed.ex and bin\syncolor.e. You are welcome to make improvements. There is a section at the top of ed.ex containing "user-modifiable" configuration parameters that you can adjust. The colors and the cursor size may need adjusting for some operating environments.
euphoria\bin\ed.bat can be set up to run ed.ex using exwc.exe or ex.exe. You are better off running ed with ex.exe on Windows 95/98/ME. You'll get much quicker screen updates than with exwc.exe. On Windows XP you'll be a bit better off using exwc.exe. You'll get slightly quicker screen updates, and you'll be able to create files with long names, not just open existing ones. However some special keys won't work with exwc.exe, e.g. you'll have to use control-t and control-b instead of control-Home and control-End. On Linux and FreeBSD there are no problems with long filenames, and the keyboard response is always fast.