Finding and replacing text
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 Edit->Find or pressing F4. The window shown will then appear. Target string may be any combination of words, numbers, letters, spaces or other non-printing characters.
Searching for a string
Choose Edit->Find or press F4. 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 will appear.
Click on Continue in this dialogue to look for the next instance of the string.
Other Find and Replace options
- 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.
- To replace just this string, click on Last Replace.
- To replace the found string and move to the next instance click on Replace.
- To replace all instances of the found string click on End of file replace.
- To undo the last replace click on Undo. Click on ReDo to replace it again
- To quit Find click on Stop.
- To delete more than one instance of a string find the string and replace it with nothing, that is, leave the Replace box blank.
- To count the number of instances of a string choose Edit->Find then click on Count.
Making searches case sensitive
By default, Find text makes no distinction between upper and lower case. For example, It will find HELLO, hello, or HeLLo. If you click on Case sensitive , however, it will find only those instances which match exactly in case.
Using magic characters
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:
\* | matches jon, john and johaan. |
\a | Match any single alphabetic or numeric character. So t\ap matches tip, tap and top, but not trap. |
\n | Match any digit (0 to 9). |
\. | Match any character at all, including spaces and non-alphabetic characters. |
\n | Match the newline character. To the computer, this is a character just like any other. |
\cX | Match Ctrl-X, where X is any character. |
\& | Used in the Replace with box to re the Found string. This is particularly useful when you've used magic characters in the Find string. For example, if you've searched for t\ap, and you want to add an s to the end of all the strings found, \&s in the Replace with box will replace tip, tap and top by tips, taps and tops. |
\\ | Search for a string actually containing the backslash character \ while using magic characters To search for the strings cat\a or cot\a enter c\at\\a. |
\xXX | Match characters by their ASCII number, expressed in hexadecimal. Thus \x61 matches lower case a. This is principally useful for finding characters that are not in the normal printable range. |
Using wildcarded expressions
There is also a facility for specifying wildcarded expressions in search strings. Click on Wildcarded expression s 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.
The wildcard characters operate as follows.
. | Any | Match any single character |
$ | Newline | Match linefeeds |
@ | Alphanum | Match any alphanumeric character (A to Z, a to z, 0 to 9, and _) |
# | Digit | Match 0 to 9 |
| | Ctrl | Match any control character. For example, to search for Ctrl-Z, type in |z. |
\ | Normal | Match any character following it even if it is a special character. For example, # would be searched for as \# |
[ ] | Set | Match any one of the characters between the brackets. This is always case sensitive. |
- | To | Match any character (in the ASCII character set) between two given characters (e.g. a - z). |
~ | Not | Does not match character. ~C matches any character apart from C. This can also be applied to sets. |
* | 0 or more | Match zero or more occurrences of a character or a set of characters. T*O matches T, TO, TOO, TOOO etc.
| ^ | 1 or more | Match one or more occurrences of a character or a set of characters. T^O matches TO, TOO, TOOO etc. |
% | Most | % is the same as ^, except when used as the final element of a search string. In this case the longest sequence of matching characters is found. |
& | Found | Match the found string. This is useful with wildcard characters in the Find string. For example, if you've searched for t.p, and want to add an s to the end of all the strings found, &s in the Replace with string will replace tip, tap and top by tips, taps and tops. |
? | Field | 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 %#fred¸$ there are two ambiguous parts, %# and ¸$ - which are ?0 and ?1 respectively. Ambiguous parts are numbered from left to right. (Only to be used in the Replace with string).
| X | Hex | Match the character whose ASCII number is nn, where nn is a two-digit hex number. eg. X (Hex button) 61 matches lower-case a. This is mainly useful for finding characters that are not in the normal printable range. |
The full power of the wildcard facility can be illustrated by a few examples:
- To count how many lower case letters appear in a piece of text: Find: [a-z] and click on Count.
- To count how many words are in a piece of text use Find: %@ and click on Count.
- To surround all words in a piece of text by brackets use Find: %@ Replace with: (&) and click on Go, then on End of File Replace in the Found dialogue box.
- To change all occurrences of strings like #include "h.foo" into #include "foo.h" use Find: \#include "h\.%@" Replace with: #include "?0.h" and click on Go, then on End of File Replace in the Found dialogue box.
- To remove all ASCII characters other than those between space and , and the newline character from a file use Find:~[ -\~$] 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 \ as ~ would not make sense in this context if it had its special meaning of Not: Find: [ -$]
Reading in text from another file
If you want to add all the text from another file into the current file:
- Position the caret at the point where the inserted text is to appear.
- 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 to copy just a part of the text from one file into another:
- Highlight the text you want to copy to the second file, then choose Edit->Copy , or press Ctrl-C. This will copy the highlighted text on to Clipboard. Now position the caret in the second file where you want the text to appear and press Ctrl-V or choose Select->Paste.
- Position the caret in the destination file. Highlight the text you want to copy to the second file, then drag the Edit->Save selection->Save as icon into the destination file.
Formatting text
Formatting describes how the text in Edit is arranged on the page.
Before you can use these features, click in the Edit window to get the input focus (the title bar will turn yellow).
To set a margin choose Display->Margin. Type in a value and press Return. You can have one lefthand margin set at a time in Edit. The margin is set in pixels.
To set the line spacing choose Display->Line spacing. Type in a value and press Return. Line spacing is set in pixels, and can be a positive or negative value.
To reformat all lines in a paragraph to a given length place the cursor anywhere in the paragraph, choose Edit->Format text, type in a value for width and press Return. Useful for tidying up after editing. Width is measured in characters per line. This value is also used by the Wordwrap option.
To make your text fit the size of the window choose Display->Window wrap. Revert to default by choosing the option again.
To prevent words being split over lines as you type choose Misc->Wordwrap. A newline character is inserted at the end of a line and the next whole word is wrapped onto the next line. Line length is set in the Edit->Format text option.
To convert linefeeds to carriage returns (and vice-versa) choose Edit->CRLF. Choose again to undo. Carriage returns appear as [0D] in the text.
Indenting 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:
- A positive number gives you an indent of the specified width.
- A negative number: -5, for example, deletes the specified number of spaces or characters from the beginning of the block line - use this to cancel an indent.
- You can also type in text: IGNORE, or 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
Using tabs
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.
Laying out tables with irregular columns
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:
Laying out tables with regular columns
Pressing Tab with Misc->Column tabs switched on sets tabs every eight spaces.
Converting tab characters to column tabs
If you import text from a word processor this may have tab characters ([09]) 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.
Changing the display font
You can display Edit files using any available desktop font.
To change the screen font displayed by Edit choose from the Display->Font submenus. Tabs and columns will not look right in proportional fonts.
To change the screen font size you should choose the size in points from the Display->Font sizemenu. You can specify a different size in the bottom of the Font size menu.
To change the screen font height choose Display->Font height then the size you want (in points). The current width will not be changed (you should use Display->Font size for this).
To change the text colour choose a colour from the Display->Foreground submenu. To change the background colour choose a colour from the Display->Background submenu.
To Invert text and background colours choose Display->Invert . Choosing this option again toggles back.
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.
Exporting (saving) text
The Save menu lets you save a complete file or part of a file.
To save a new file: Press MENU over the Edit file and drag the icon in the Save->Save as box to the destination directory (changing the default name TextFile if necessary). You can also press F3 to display the Save as box.
To save a file that's already been saved: Press F3 followed by Return .
To save part of a text file Select the text you want to save. Press MENU, drag and drop the Selection->Save->Save as icon. You can use this method to export text to another Edit file, or another application (e.g. Draw later).
Printing Edit files
There are several ways of printing an Edit file. To use them, you first need to load the Printers application.
To print an open Edit file choose Misc->Print. You can also press the Print key, or drag the Save->Save as icon onto the printer's icon bar icon.
To print a selection you should choose Select->Print. You can also drag the Select->Save as icon onto the printer's icon bar icon.
To print an Edit file not currently open drag the file's icon to the printer's icon bar icon. You can also do this if the file is loaded. Unsaved changes will not print.
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.
|