Edit is an extensible text editor for the Oberon system. It is based on a few simple concepts and aims at typical writing tasks, such as memos and reports. It does not try to support a document model, and it is not fully "wysiwyg". To arrive at a rather simple implementation, the few concepts provided have been carried out with all consequences. This should be kept in mind before considering a certain behaviour of the editor to be a "bug". The following tutorial assumes that the reader already knows how to use the Oberon system, especially, how to handle viewers, files, and commands.
In a second part, EditTools (a collection of supportive commands) is described. Study of this part can be delayed till special needs occur.
Principles
A text models a sequence of characters. Besides standard characters, Edit supports special user extensible characters. Such characters, called text elements or simply elements, float in the text just as ordinary characters do. Typical elements support the integration of graphics and the like into texts. A standard extension of elements allows for separating the text into paragraphs. Such elements are called paragraph controls or parc for short. A parc defines the paragraph attributes for all characters following it up to the next parc or the end of the text.
Editing
Insertion of new characters into the text requires setting the caret left to the character before which to insert, or to the end of the text. The caret can be set by clicking the left mouse key at the desired location.
Selecting a stretch of the text corresponds to selecting a range of characters. The visible selection extends from the beginning of the first selected character to the beginning of the first character behind the selection or the end of the text. Hence, selections always reflect the exact area which is affected when changing or deleting. A stretch of text is selected by dragging the the right mouse key over the characters to be selected.
While setting the caret or selecting a stretch of text, other mouse keys can be interclicked to execute further editor functions. Interclicking means clicking a mouse key while another one is pressed. The following interclicks are interpreted by a text viewer:
buttons effect
left + middle copies the most recent selection to the place where the caret will be set on release of the left key
left + right copies the attributes of the character to the right of the caret to the most recent selection
right + left deletes the selection being tracked on release of the right key
right + middle copies the selection being tracked to the caret location on release of the right key
left + middle + right cancels an erroneous interclick
Clicking the mouse in the scroll bar has the following effects:
buttons effect
left forward scroll. The line at the mouse position will be moved to the top of the viewer
right backwards scroll. The line at the mouse position will be moved to the bottom of the viewer
middle absolute positioning
middle + left scroll to end of text
middle + right scroll to beginning of text
The cursor left/right keys move the caret. To support editing indented text (like programs), the Linefeed key can be used instead of Carriage-Return. This will indent the next line to the same level as the previous paragraph. The cursor left/right keys will shift indented text if it is selected in the focus viewer. Furthermore, when extending a selection over two consecutive viewers, Edit adds visual feedback. This avoids the danger of extending a selection by mistake and then deleting or copying a far larger stretch of text than was intended. See below for a description of commands that further support basic editing.
Some elements support inplace editing. To use this feature, an element must be focussed by clicking into its area using the left mouse button. A focussed element is highlighted using a grey frame. As long as the focus remains set, mouse clicks in the area of the element are interpreted to allow for inplace editing.
In order to insert a parc into a text, place the caret at the appropriate position and press BREAK. This will copy the parc above the caret position (or the default parc if there is none above). Using the command Edit.Parcs parcs can be made visible or hidden again.
If visible, a parc is displayed as a separation line corresponding to the width set for that paragraph. Above that separation line, one or two marks signal the formatting mode of the paragraph: a single mark at the very left, in the middle, or at the very right indicates left flush, centered, or right flush formatting, respectively. Two marks at both ends indicate block (fully justified) formatting. Below the separation line, set tabs are indicated by marks. Pressing Shift-BREAK inserts a parc which forces a page break (attribute break=before). Such parcs are displayed using a solid separation line.
A parc defines a special behaviour for middle-button mouse clicks. It has two separate sensitive areas. One above and one below the separation line. The following table shows how various middle mouse button clicks and interclicks affect the paragraph attributes bound to a parc. Again, see the commands below for further manipulations of parcs.
where buttons effect
above separation line, left end middle inset left margin
above separation line, left end middle + right symmetric inset of left & right margin
above separation line, right end middle inset right margin
above separation line, right end middle + right symmetric inset of left & right margin
above separation line, left end middle + left set first line indentation mark
above separation line, first mark hit middle move first line indentation mark
above separation line, towards left end middle left flush formatting
above separation line, in the middle middle centered formatting
above separation line, towards right end middle right flush formatting
above separation line middle + left block formatting
above separation line middle + right toggle one/two column formatting
below separation line, no tab mark hit middle create new tab
below separation line, tab mark hit middle move tab
below separation line, tab mark hit middle + right move tab and all subsequent tabs in synch
below separation line, tab mark hit middle + left delete tab
Printing
When printing a text, Edit reformats individual paragraphs for the printer. Edit preserves all user setable measures, while individual words may be placed differently. This allows for optimal display of texts on the screen, while at the same time fully exploiting the printer resolution. Hence, it should not be tried to affect the placing of individual words by inserting additional blanks or the like! Furthermore, Edit ignores all empty space at the beginning of a page except when preceded by a parc with enforced page break attribute. White space in this sense are empty lines (a single blank makes a line non-empty!) and lead-space defined by a parc. Refer to the print command description below for details on how to initiate a printout.
For two columns the width of a column is set by the corresponding parc, while the horizontal origin x of the right column is computed based on the body width w selected for printing:
xrightCol = xleftCol + 0.57wbody + 3.5mm.
The actual gap between the left and the right column then is:
In order to achieve good results, the Lm3 metrics files for the used font families should be available. For example, when using the fonts Syntax12, Math12, Syntax14, and LetterHead, the metrics files Syntax.Lm3.Fnt, Math.Lm3.Fnt, and LetterHead.Lm3.Fnt are required. If a metrics file for a used font is missing, the printer metrics are estimated using a simple heuristics based on the screen font metrics. Beware: this leads to at most draft quality of the printed text.