Showing posts with label Editing Lines in New Files. Show all posts
Showing posts with label Editing Lines in New Files. Show all posts

Tuesday, 1 November 2016

The GW-BASIC Screen Editor

You can edit GW-BASIC program lines as you enter them, or after they have been saved in a program file.

4.1 Editing Lines in New Files

If an incorrect character is entered as a line is being typed, it can be deleted with the BACKSPACE or DEL keys, or with CTRL-H. After the character is deleted, you can continue to type on the line.

The ESC key lets you delete a line from the screen that is in the process of being typed. In other words, if you have not pressed the RETURN key, and you wish to delete the current line of entry, press the ESC key.

To delete the entire program currently residing in memory, enter the NEW command. NEW is usually used to clear memory prior to entering a new program.

4.2 Editing Lines in Saved Files

After you have entered your GW-BASIC program and saved it, you may discover that you need to make some changes. To make these modifications, use the LIST statement to display the program lines that are affected:

 Reload the program.

 Type the LIST command, or press the F1 key.

 Type the line number, or range of numbers, to be edited.

The lines will appear on your screen.

4.2.1 Editing the Information in a Program Line

You can make changes to the information in a line by positioning the cursor where the change is to be made, and by doing one of the following:

Typing over the characters that are already there.

Deleting characters to the left of the cursor, using the BACKSPACE key.

Deleting characters at the cursor position using the DEL key on the number pad.

Inserting characters at the cursor position by pressing the INS key on the number pad. This moves the characters following the cursor to the right making room for the new information.

 Adding to or truncating characters at the end of the program line.

If you have changed more than one line, be sure to press RETURN on each modified line. The modified lines will be stored in the proper numerical sequence, even if the lines are not updated in numerical order.


Note:- 
A program line will not actually have changes recorded within the GW-BASIC program until the RETURN key is pressed with the cursor positioned somewhere on the edited line.


You do not have to move the cursor to the end of the line before pressing the RETURN key. The GW-BASIC Interpreter remembers where each line ends, and transfers the whole line, even if RETURN is pressed while the cursor is located in the middle or at the beginning of the line.

To truncate, or cut off, a line at the current cursor position, type CTRL-END or CTRL-E, followed by pressing the RETURN key.

If you have originally saved your program to a program file, make sure that you save the edited version of your program. If you do not do this, your modifications will not be recorded.

4.3 Special Keys

The GW-BASIC Interpreter recognizes nine of the numeric keys on the right side of your keyboard. It also recognizes the BACKSPACE key, ESC key, and the CTRL key. The following keys and key sequences have special functions in GW-BASIC:



 BACKSPACE or CTRL-H    


           

Deletes the last character typed, or deletes the character to the left of the cursor. All characters to the right of the cursor are moved left one position. Subsequent characters and lines within the current logical line are moved up as with the DEL key.

 CTRL-BREAK or CTRL-C

           Returns to the direct mode, without saving changes made to the current line. It will also exit auto line-numbering mode.

CTRL-CURSOR LEFT or CTRL-B
         

             Moves the cursor to the beginning of the previous word. The previous word is defined as the next character to the left of the cursor in the set A to Z or in the set 0 to 9.
 CTRL-CURSOR RIGHT or CTRL-F
 Moves the cursor to the beginning of the next word. The next word is defined as the next character to the right of the cursor in the set A to Z or in the set 0 to 9. In other words, the cursor moves to the next number or letter after a blank or other special character.  Moves the cursor to the beginning of the next word. The next word is defined as the next character to the right of the cursor in the set A to Z or in the set 0 to 9. In other words, the cursor moves to the next number or letter after a blank or other special character.
CTRL-HOME or CTRL-L      
 Clears the screen and positions the cursor in the upper left corner of the screen.
 CURSOR LEFT or CTRL-]  




             Moves the cursor one position left. When the cursor is advanced beyond the left edge of the screen, it will wrap to the right side of the screen on the preceding line.
CTRL-K or HOME    
 Moves the cursor to the upper left corner of the screen. The screen contents are unchanged.
 CTRL-G     

Causes a beep to emit from your computer's speaker.

 CTRL-[ or ESC  


 Erases the entire logical line on which the cursor is located.
 CTRL-M or RETURN    

Enters a line into the GW-BASIC program. It also moves the cursor to the next logical line.
CTRL-RETURN or CTRL-J     
Moves the cursor to the beginning of the next screen line. This lets you create logical program lines which are longer than the physical screen width. Logical lines may be up to 255 characters long. This function may also be used as a line feed.
 CTRL-N or END  

Moves the cursor to the end of the logical line. Characters typed from this position are added to the line.
CTRL-END or CTRL-E         
 Erases from the cursor position to the end of the logical line. All physical screen lines are erased until the terminating RETURN is found.
CTRL-BACKSPACE or DEL   
Deletes the character positioned over the cursor. All characters to the right of the one deleted are then moved one position left to fill in where the deletion was made.If a logical line extends beyond one physical line, characters on subsequent lines are moved left one position to fill in the previous space, and the character in the first column of each subsequent line is moved up to the end of the preceding line.DEL (delete) is the opposite of INS (insert). Deleting text reduces logical line length.
 CURSOR DOWN or CTRL--            

Moves the cursor down one line on the screen.
 CURSOR UP or CTRL-6         

Moves the cursor up one line on the screen.
 CURSOR RIGHT or CTRL-\

 Moves the cursor one position right. When the cursor is advanced beyond the right edge of the screen, it will wrap to the left side of the screen on the following line.