www.riscos.com Technical Support:
RISC OS 3.7 User Guide
Edit is a text editor which you can use to create and edit plain text, and to generate simple text documents and command scripts.
Edit is also a BASIC program editor. It converts BASIC programs into text format for editing, and then converts them back again when they are saved.
Although Edit does have some sophisticated features for handling text, it has not been designed as a word processor. Word processors offer facilities for pagination and page layout control as well as paragraph styles and printable fonts.
|Edit is in the Apps icon bar directory display. To start Edit, double-click on the !Edit application icon. The application icon appears on the icon bar.|
To display an existing text file just double-click on it, or drag the file's icon to the Edit icon on the bar.
To display any other file type, drag the file icon to the Edit icon on the bar, or hold down Shift and double-click on it. BASIC files are displayed as text.
Click on the Edit icon on the icon bar to open a new document.
You can open new windows for other specific types of file, Text, BASIC, Obey and Command files. To do this, choose Create from the Edit icon bar menu and specify the file type you want. Alternatively you can type in a file type of your own choice at the bottom of the Create menu.
When you first open a new Edit window a red I-shaped bar - the caret - appears at the top left of the window. This is where text appears when you start typing. You can open more than one Edit window (see Other features of Edit) but only one (the current window) has the caret in it. This window is said to have the input focus, and is also identified by its cream rather than grey title bar. You can only type in the window which has the input focus.
If you type in some text without pressing Return at all, the window scrolls sideways (if your Edit window is smaller than your screen). You can break your text into lines by pressing Return. Alternatively, click on the Toggle size icon to extend the window to the full size and avoid having to scroll sideways.
As you type, notice that Edit fills the current line and then carries on to the next line, often breaking words in the middle. By default, it doesn't automatically enter formatting characters such as newline, as these might create problems in scripts and programs, and in transferring text into other editors. The section Formatting text later tells you how to set wordwrap and other formatting options if you want them.
Here are some basic techniques for entering and deleting text:
There are quicker ways of deleting a lot of text - see the section Block editing operations later.
You can edit more than one character at a time by defining a block of text you want to edit, then cutting, copying or pasting the whole block. A block of text can be one or two characters, a word, a line, a paragraph or the whole document.
First select a block of text as described in the previous section
If you make a mistake or have second thoughts about an edit, choose Edit/Undo (or press F8) to step back through your most recent changes. The number of changes you can reverse in this way varies according to the operations involved.
Edit/Redo (or the F9 key) allows you to remake the changes you reversed with Undo.
Edit has a very sophisticated find and replace function, to enable you to find words or characters in a document and replace them by others if you wish.
To find a particular word or character (the 'target string') position the caret at the start of the file before choosing Find. The target string may be any combination of words, numbers, letters, spaces or other non-printing characters.
Choose Edit/Find and the Find window will appear. Type in the string you wish to find and click on Go.
If you've already tried to find the string once and want to search for it again, click on Previous.
If the string is not located, the message Not found is displayed. If it is found, the Text found dialogue box appears
Click on Continue to look for the next instance of the string.
To Replace one string by another choose Edit/Find as above. Type in the string to be found then press Return once. Type in the string to replace it and click on Go. If the string is found the Text found window will open.
The picture below shows the keyboard shortcuts which can be used while the Found window is open.
By default Find text makes no distinction between upper and lower case. It will find for example HELLO, hello, or HeLLo. If you click on Case sensitive, however, it will find only those instances which match exactly the case of the search string.
You can also use find and replace special or 'magic' characters. Click on Magic characters (or press F5) in the Find dialogue box and a list of them will be displayed in the lower half of the dialogue box.
Magic characters start with a \ character, and you type them into the Find and Replace with boxes exactly as shown.
Functions and their magic characters:
There is also a facility for specifying wildcarded expressions in search strings. Click on Wildcarded expressions in the Find dialogue box to display the ones you can use.
Click on the wildcard character you wish to enter and it is copied into the text box at the caret.
Functions and the wildcard symbol to click on:
|Match any single character|
|Match any alphanumeric character (A to Z, a to z, 0 to 9, and _)|
|Match 0 to 9.|
|Match any control character. For example, to search for Ctrl-Z, type in |
|Match any character following it even if it is a special character. |
|Match any one of the characters between the brackets. This is always case sensitive.|
|Match any character (in the ASCII character set) between two given characters (e.g. a - z).|
|Not match character. |
|Match zero or more occurrences of a character or a set of characters. |
|Match one or more occurrences of a character or a set of characters. |
|Match the found string. This is useful with wildcard characters in the Find string. For example, if you've searched for |
|Match the nth ambiguous part of the search pattern, where n is a digit from 0 to 9. Ambiguous parts are those which could not be exactly specified in the search string; e.g. in the search string |
|Match the character whose ASCII number is nn, where nn is a two-digit hex number. X (Hex button)|
The full power of the wildcard facility can be illustrated by a few examples:
[a-z]and click on Count.
%@and click on Count.
(&)and click on Go, then on End of File Replace in the Found dialogue box.
\#include "h\.%@"Replace with:
#include "?0.h"and click on Go, then on End of File Replace in the Found dialogue box.
~[ -\~$]Replace with:
(nothing)and click on Go, then on End of File Replace in the Found dialogue box (i.e. find all characters outside the set from the space character to the ~ character, and newline, and replace them with nothing). In fact this could be written without the \, since ~ would not make sense in this context if it had its special meaning of Not: Find:
If you want to add all the text from another file into the current file then position the caret at the point where the inserted text is to appear. Now open the directory display for the source file, and drag its icon into the destination text window.
The entire contents of the source file is then copied into the destination file, starting at the caret position. The caret appears at the end of the text you have inserted.
There are two ways of reading in part of one file into another.
Before you can use these features, click in the Edit window to get the input focus (the title bar will turn yellow).
[0D]in the text.
You can indent a selected block of text in Edit. The indent is defined in character spaces. You can indent using just spaces, or add a text prefix to the beginning of each line of a block.
To indent a selected block of text, choose Edit/Select/Indent.
You can then type in one of three different types of indent.
Note, for example. This will then appear at the beginning of every line in the selected block. You can remove this text by indenting with a suitable negative number
Tabs in Edit are designed to work with fixed-pitch fonts, such as the System font. If you use tabs in Edit with proportionally-spaced fonts (such as Trinity, for example), tables will not line up properly.
Lay out the first line of a table (the headings, for example) using spaces between each column. On the next line, press Tab and the cursor will jump to each column in turn.
Pressing Tab with Misc/Column tabs switched on sets tabs every eight spaces.
You may have text imported from a word processor, which has tab characters () embedded in it. These can be expanded into Edit regular column tabs (eight spaces for each tab character) by choosing Edit/Expand tabs.
The text will be reformatted so that each tab character is replaced by eight spaces.
You can display Edit files using any available desktop font.
Note: Font information is not saved with the Edit file, so does not print. You can only have one style of text at a time in each Edit document.
The Save menu allows you to save a complete file; you can also save part of a file.
TextFileif necessary). You can also press F3 to display the Save as box.
There are several ways of printing an Edit file; to use them, you first need to load the Printers application (refer to the section Printing your files).
Note: Edit files are always printed out using the printer's default font. This overrides any screen font (chosen from the Edit/Display/Font menu).
This section describes some features of Edit that you won't need to use very often.
Edit allows you to write BASIC programs, converting the Text files produced in Edit to tokenised BASIC files. A tokenised file is one where BASIC keywords are replaced by seldom-used ASCII characters, to make the program smaller and faster in execution.
To write a new program, choose Create/BASIC from Edit's icon bar menu. You can type your program directly into an Edit window. There is no need to include line numbers, as Edit will insert them for you when you save the file. Press Return at the end of the last line of the program.
To use Edit for working on an existing BASIC program, simply drag the program's icon from its directory onto the Edit icon on the icon bar, or Shift double-click on its icon.
By default, line numbers will be stripped when a BASIC file is loaded. To turn this option on or off, choose Strip line numbers from the Edit icon bar menu. If a reference to a line is found, an error box will appear.
Line numbers are added when a BASIC file is saved. Use Line number increment from the Edit icon bar menu to set the number increment between successive lines in the program.
A tokenised file saves space: top-bit-set characters and control characters (non-printing characters) are used to stand for the BASIC keywords. So, for example, the Hex character E3 stands for the keyword FOR.
Converting a text file to a tokenised file is usually quite straightforward. If there are no line numbers, by default Edit will start at 10 and increment by 10. If line numbers are supplied, these are used as a basis for any lines without line numbers.
If there are line numbers, Edit will not sort them into ascending sequence and the resulting BASIC program may behave strangely.
If your code is incomplete, Edit will warn you about the following problems:
In all cases Edit will also quote the offending line number. After you have clicked on OK, the tokenising continues.
Attempts to tokenise a crunched program (e.g. one with the spaces removed) will generally result in a non-functioning program.
If you have Edit running, you can print a BASIC program on paper by dragging its icon onto a printer driver icon. Edit will perform the conversion to allow the program to be printed.
Choose Quit from the Edit icon bar menu to stop Edit and remove it from the computer's memory. A dialogue box may be displayed, warning you if there are any current files you have not saved.
You may wish to change some aspects of the way new Edit windows appear. For example, a new window normally opens using black text on a white background, but you may prefer to have blue text on a red background ready to use each time you start Edit.
You can set features of this type by setting up Edit just as you wish to use it, then save these features by creating a Desktop boot file. Instructions on how to create a Desktop boot file are given in the section Configuring applications.
On occasions, it can be quicker when you are working in Edit to use the keyboard instead of the mouse, especially once you are familiar with the program.
Actions and keys to press:
Actions and keys to press:
Actions and keys to press:
Note: these keystroke definitions only come into play once the Find dialogue box has been displayed (e.g. by typing F4).
Actions and keys to press:
Actions and keys to press: