The editor provides many editing and word processing features. These are carried out in response to the user typing an appropriate key on the keyboard, or by the same code being written from the applications program. The following sections describe each of the editing functions in some detail.
Some of the editing functions such as paragraph movement and reforming paragraphs, require fairly complex internal operations to be carried out. This often results in rather strange behaviour of the screen display, involving scrolling operations which might not be expected.
The four joystick directions and the ins, del and erase keys each have three different functions which are explained below. These functions are obtained by using the key alone, or with either shift or ctrl keys. In fact the ctrl function can also be obtained by using the alt key.
Cursor movement is the most fundamental operation for a full screen editor. On the , cursor movement is carried out with the joystick in conjunction with the shift and ctrl keys. The autorepeat on the joystick allows continuous cursor movement by just holding the joystick in one of its eight possible directions.
The cursor can be moved anywhere on the video page but cannot be moved off the page. If an attempt is made to move it off the top or bottom of the page the the display will scroll to bring more text from the buffer onto the page. This scrolling will stop when the start or end of the text is reached.
The cursor can be moved beyond the end of lines or outside the margin settings without the text being affected. However when a character is typed, extra spaces will be put on to fill up to the cursor position and word wrap may occur if the cursor is outside the margins.
Although only the four orthogonal directions of cursor movement are provided by the editor, diagonal movement is still possible. This is because if the joystick is moved to one of the diagonal positions, the keyboard driver autorepeat will return the appropriate two joystick codes alternately so the editor will execute them alternately. This is only useful for simple cursor movements, not for the shifted and controlled movements.
The possible cursor movements and their codes are:
Joystick Movement Key Code Function UP 0B0h Cursor up line Shift-UP 0B1h Cursor up page Ctrl-UP 0B2h Cursor up paragraph DOWN 0B4h Cursor down line Shift-DOWN 0B5h Cursor down page Ctrl-DOWN 0B6h Cursor down paragraph LEFT 0B8h Cursor left character Shift-LEFT 0B9h Cursor left to start of line Ctrl-LEFT 0BAh Cursor left word RIGHT 0BCh Cursor right character Shift-RIGHT 0BDh Cursor to end of line page Ctrl-RIGHT 0BEh Cursor right word
The simple left and right movements move the cursor by one character left and right. There is no wrap around from one line to the next so if the cursor is at the extreme left or right of the video page then attempting to move it further will have no affect.
Moving the joystick left or right with the shift key held down will move the cursor to the start or end of the current line respectively. In this context the start of the line is the first actual character in the line, discounting any spaces up to the left margin of that line. The end of the line is the last actual character in the line discounting any trailing spaces which are not represented in the buffer (althought there may be spaces which are in the buffer).
Joystick left or right with the ctrl key held down moves the cursor left or right by a word. The exact definition of a word is rather complex but is basically a string of alphanumeric characters and a string of nonalphanumeric characters in either order. Moving left or right by a word does wrap around between lines.
The straightforward joystick up or down operations moves the cursor up or down by one line. The cursor always remains in the same column position. If the cursor is on the top or bottom line of the video pages then, assuming that there are more lines in the buffer, the video page will be scrolled appropriately to bring another line onto the display. If the cursor is on the first or last line of the text then nothing will happen.
Moving the joystick up with the shift key held down will move the cursor up by a page. If the cursor is on the top line of the video page then the page will be scrolled one less lines than the height of the page so that the old top line is now the bottom line and the rest of the video page is new lines from the buffer. If there are insufficient lines in the buffer then the scrolling will stop when the first line of text is on the top line of the video page. If the cursor was not at the top of the page then it is moved to the top line of the page.
For moving down by a page the situation is analogous, with the cursor being moved to the bottom line of the page unless it is there already in which case the page will be scrolled up. In either case the cursor will be left on the same column as it started on.
Moving up and down by paragraph (by using ctrl) is rather different from other up and down movements. In moving up by a parargraph the cursor will be put on the first character of the current paragraph, unless is is already on the first character in which it case it will be put on the first character of the previous paragraph. The video page will of course be scrolled appropriately to ensure that the cursor remains on the screen.
Moving down by a paragraph always moves the cursor to the start of the next paragraph unless it is already in the last paragraph in which case it will be left at the end of that paragraph.
The insert key has three separate functions which are:
Key Combination Key Code Function INS 0A8h Insert a space Shift-INS 0A9h Insert a newline Ctrl-INS 0AAh Toggle insert/overwrite mode
When the ins key is used on its own it simply inserts a space character before the cursor position and leaves the cursor on this space. It is useful for inserting a few characters whil in overwrite mode (see below). This is done simply by inserting the correct number of spaces and then overtyping them with the required characters.
When the ins key is used with the shift key, the current line will be split with a hard carriage return (end of paragraph marker) at the cursor position. If the cursor is at the start or end of a line then this will have the effect of inserting a bank line.
When the ins key is used wih the ctrl key, it toggles between insert and overwrite mode, the initial default being overwrite mode. The current mode is indicated by the cursor which is changed to a different character depending on the mode. For overwrite mode it is character number 14 (a rectangular block) and for insert mode it is character number 30 (a leftpointing arrow).
In overwrite mode if a character is typed when there is already a character at the cursor position then the old character will replaced by the new one. In insert mode the new character will be inserted before the old character and the old character along with the rest of the line will be moved on character to the right.
Wether overwrite or insert mode is selected also affects some details to do with word wrapping and splitting lines in the middle of the buffer.
The del and erase keys have very similar functions, both delete characters from the buffer. Basically the del key goes rightwards while the erase key goes leftwards. Each key has three functions which correspond to the three types of horizontal cursor movement.
Key Combination Key Code Function DEL 0A0h Delete character right Shift-DEL 0A1h Delete line right Ctrl-DEL 0A2h Delete word right ERASE 0A4h Erase character left Shift-ERASE 0A5h Erase line left Ctrl-ERASE 0A6h Erase word left
If used without the shift or ctrl keys then del and erase each delete a single character and move the rest of the line left to fill up the gap. Del deletes the character under the cursor leaving the cursor in the same position, while erase deletes the character to the left of the cursor and then moves the cursor onto the previous character.
Both functions wrap around between lines and thus can be used to join lines together. If the cursor is on the first character of a line then erase will join this line to the previous line. The line separator counts as one character as far as deletion goes. Del will join the current line to the next one if it is at the end of a line.
When used with shift, the erase and del keys delete to the start and end of the current line respectively. If already at the start or end of the line then nothing will be done, these functions do not join lines together.
When del and erase are used with the ctrl key they delete one word, using the same defenition of a word as cursor movement. The deletion is done by repeatedly deleting characters until the end of the word is reached. These functions will join lines together and for this purpose the line separator counts as a word. As usual del deletes rightwards and erase deletes leftwards.
The tab key (key code 09h
) move the cursor to the
next tab stop, or to the start of the next line if there are no more tab
stops on this line. The current tab settings can be seen on the ruler
line if it is displayed.
In overwrite mode the cursor is simply moved to the next tab stop. In insert mode the next tab stop is reached by inserting spaces and moving any more text on the line to the right. When moving to the start of a new line in insert mode, spaces will be inserted up to the right margin and then a new line will be inserted (not an end of paragraph marker).
The more complex editing functions, and particularly the word processor type functions are carried out by using the eight function keys in conjunctions with ctrl or alt. This gives a possible 16 editing functions although only 14 of these are utilised because function key 8 is not used.
These 14 editing functions are listed here, along with their key codes and each one is then described in more detail in the following sections.
Key Combination Key Code Function Ctrl-F1 0F0h reform paragraph Ctrl-F2 0F1h centre line Ctrl-F3 0F2h toggle tab Ctrl-F4 0F3h set left margin Ctrl-F5 0F4h release margins Ctrl-F6 0F5h move paragraph up Ctrl-F7 0F6h change line colour Alt-F1 0F8h justify paragraph Alt-F2 0F9h remove all tab stops Alt-F3 0FAh toggle ruler line display Alt-F4 0FBh set right margin Alt-F5 0FCh reset margins and tabs Alt-F6 0FDh move paragraph down Alt-F7 0FEh change paragraph colour
Reform and justify paragraph are very similar functions, in fact justify does exactly the same as reform but also justifies. Both operate on the paragraph containing the cursor, and leave the cursor on the start of the next paragraph. This means that pressing one of these keys repeatedly will reform (or justify) each paragraph of a document in turn, without need for using the joystick.
Reform paragraph moves to the start of the paragraph and then walks through the paragraph to the end. As it goes it adjusts the left margin of each line to be equal to the current left margin, removes any soft spaces (left over from previous justification) and word wraps each line to the current right margin, joining lines together where possible.
The result is that the new paragraph appears exactly as it would if all the characters of the paragraph were newly typed in, so any untidy sections resulting from other editing operations will be reformed.
Justify does exactly the same as reform but it also inserts soft spaces into each line of the paragraph except the last one, to ensure that each line finishes exactly on the right margin.
Centre line is a fairly simple function which operates on a single line, not a whole paragraph. It inserts sufficient spaces before the line to centre it between the current margins. Leading and trailing spaces are first removed to ensure that they are not included in the centring. The cursor is left on the start of the line. If the line is too long to fit between the margins then it will be left so that it starts at the left margin position.
The ruler line display is a red line which can be displayed on the very top line of the video page. It indicates where the left and right margins are set and also the positions of any tab stops.
The left margins is indicated by an 'L' and the right margin by an 'R'. Tab stops are marked by a vertical bar and other character positions between the margins are indicated by dashes. Also if the margins are released (see below) then an asterisk will be displayed in the extreme right hand position of the ruler line.
This function key simply toggles the ruler line display on and off, the default being off. All the facilities of tab stops and margins can be used regardless of whether the ruler line is displayed or not, but it can get confusing if it is not. The built in wordprocessor sets the ruler line display on for the user.
The toggle tab function sets a tab stop at the current cursor column, or removes it if one was already set. Tab stops can only be set between the current margin positions, although when the margins are moved tab stops which are outside them are remembered and restored when the margins are moved back out. It is advisable to have the ruler line displayed when using this function.
All tab stops can be removed by a single function key press, including those which are outside the current margin settings (and thus not visible on the ruler line). This is useful to get rid of the standard tabs before setting up your own set.
When an editor channel is opened, the tab stops are set up by default to every eight character positions since this corresponds to the standard setting for tabs on machines with fixed tab stops.
The left and right margins define what portion of the video page is used for entering and displaying text. When an editor channel is opened the margins are initialised to the widest possible setting. The user can set new margin positions by putting the cursor on the desired column and pressing the appropriate function key.
The right margin can be in any column up to two less than the video page width. Thus for a 40 column display (BASIC's default) the right margin can be any column up to 38. The left margin can be in any column from 1 up to one less than the right margin column. The default margin settings for BASIC's default channel are thus: left margin at column 1, right margin at column 38.
An attempt to set an illegal margin position will result in both margins being reset to their default settings. The applications program can use these codes to set margin positions but there is also a special function call which can be used to set the margins and also to read their current settings. This is described later.
As mentioned before there is a margin release function. This is in fact a toggle action, it releases margins on the first press and then reenables them when it is pressed again. When margins are released the margins remain displayed on the ruler line and an asterisk is displayed on the extreme right hand end.
When margins are released, all operations which normally use the margin settings use the default settings instead. Thus word wrapping will occur at the lastbuttwo column rather than the right margin and characters may be typed in outside the margins.
This function key resets the margin settings to their default values and sets up the default positions of tab stops (every eight columns).
These functions can be used to move a paragraph up or down. Each key press will move the paragraph up or down by one line, unless it is already at the start or end of the buffer. To move a paragraph by more than one line this key should be pressed repeatedly until the paragraph reaches the desired position.
The paragraph to be moved is defined to start on the current cursor line, and end at the next end of paragraph marker. Thus to move a complete paragraph the cursor should first be positioned on the first line of the paragraph. This definition of a paragraph has to be used to ensure that one paragraph can be moved through another correctly.
Although not essential it is useful to use the colour paragraph function before doing a series of moves up or down. This highlights the paragraph to make it easy to see what is going on, and also puts the cursor at the start so that the whole paragraph will be moved.
These functions can be used to change the colour of the text. The colour line function just affects the current line whereas the colour paragraph function affects the entire current paragraph, and has the side effect of moving the cursor to the start of the paragraph ready for paragraph moving.
Each change colour operation changes the colour to the next one of four
possible colour pairs, cycling back to the first pair after the fourth. A
colour pair specifies which paper and ink palette colour the video driver
will use for the text. The four colour pairs are (in order):
(0,1)
, (2,3)
, (4,5)
, (6,7)
,
with (0,1)
being the default (normally green on black).
Note that if the editor is using a hardware text page then colour pairs
(4,5)
and (6,7)
will in fact appear as pairs
(0,1)
and (2,3)
since the video driver only
supports two colour pairs in this mode.