EDIT
Format: EDIT X
Supported by: Telmac SBASIC v 24.3
Similar commands:
COMX BASIC V1.00: EDIT
Pecom 32 BASIC, Pecom 64 BASIC 1.0 and 4.0, RCA BASIC3 V1.1: EDIT
This statement opens the line number X and allows the user to modify the line on a character basis. In response to EDIT X, line X is displayed. The computer is now said to be in the "edit mode" (i.e. under the control of the EDITOR instead of in the "BASIC mode" which puts the computer under the control of the BASIC interpreter. The user can now move the cursor (by pressing the space key) to a position under the line displayed that is one character before (i.e. to the left of) the character to be modified. At this point, three EDIT options are available. The user may type I (for Insert), D (for Delete) or C (for Change). After the option is selected; the option character (I, D or C) is displayed and the cursor is now directly under the character to be modified.
The Insert option allows characters to be entered or inserted immediately after the position specified by I. The Delete option removes character from the line sequentially for each pressing of the space key i.e. pressing space key n times will delete n characters. The Change option replaces sequentially each character with the new one that is typed after C.
After the user has performed the desired modification, pressing RETURN causes line X to be retyped with the modification incorporated. Note that in one pass, only one option (I, D or C) is allowed. If necessary the user can exercise one of the 3 options as many times as is needed for all corrections to be made. When this is done, press RETURN again to "exit" from the EDIT mode and to indicate that the editing of line X is completed.
The above may be illustrated as follows where "u" denotes the space key. Type,
10 PRINT "HELLO"
To edit line 10, type:
EDIT 10
to get:
:EDIT 10
10 PRINT "HELLO"
where the line to be edited is 10. Now, position the cursor beneath the first " getting ready for the next step. To insert SAY before HELLO in line 10, select the I option, and type SAY followed by SPACE to get.
:EDIT 10
10 PRINT "HELLO"
ISAYu
Now type RETURN to get:
10 PRINT "SAY HELLO"
Type RETURN again to exit from EDIT mode.
To delete SAY, and change HELLO to JERRY, select D option, followed by 4 spaces to get:
:EDIT 10
10 PRINT "SAY HELLO"
Duuuu
10 PRINT "HELLO"
CJERRY
Pressing RETURN will display.
10 PRINT "JERRY"Note that the 5 characters HELLO have been changed or replaced by another 5 characters JERRY. Now that the editing job is completed, press CTRL S again to exit the edit mode. The computer will respond by READY showing that control is now returned to the BASIC interpreter.
For an error to occur in a short simple line, retyping the entire line using the same line number is the simplest way to do editing. For a long line, there is the possibility of introducing new errors whilst attempting to correct the old ones. In this case, the use of EDIT is preferred.
Pressing ESC while in the EDIT mode will abort the edit mode and return to BASIC mode leaving the line being edited unchanged.