
A program is never typed right the first time, and the second time you usually want it to do something else. In S4 you could move a character or a line at a time and rub out one character at a time, which is fine for four lines and hopeless for forty.
Turbo's editor has more than forty commands. This section teaches the ones you will use every day. They are all CONTROL keys, and they are laid out on the left of the keyboard on purpose - once your fingers know them you will not look.
Put your left hand on the keyboard with a finger on each of E, S, D and X. They make a diamond, and with CONTROL held they move the cursor the way the diamond points:
E
S D
X
The keys just outside the diamond go further:
In MAME: CONTROL is Ctrl.
Put CTRL-Q first and the same keys go all the way:
| Keys | Goes to |
|---|---|
| CTRL-Q CTRL-S | The start of the line |
| CTRL-Q CTRL-D | The end of the line |
| CTRL-Q CTRL-R | The top of the program |
| CTRL-Q CTRL-C | The end of the program |
| CTRL-Q CTRL-E | The top of the screen |
| CTRL-Q CTRL-X | The bottom of the screen |
| CTRL-Q CTRL-P | Back to where you were before the last jump |
Watch the status line: Line and Col tell you where you have landed.
| Keys | Deletes |
|---|---|
| DELETE | The character before the cursor |
| CTRL-G | The character under the cursor |
| CTRL-T | The word to the right of the cursor |
| CTRL-Q CTRL-Y | From the cursor to the end of the line |
CONTROL and - | The whole line |
That last one is CONTROL with the key marked - - the one that types _. In MAME: Ctrl and the - key.
Changed your mind about a line? As long as the cursor is still on it, CTRL-Q CTRL-L puts the line back as it was before you started on it. Once you move off the line, the changes stay. And it cannot bring back a line you deleted with CONTROL and -: that one is gone, so take care.
The editor starts in Insert mode, which is what the word on the status line means: what you type goes in before the cursor and pushes the rest of the line along.
CTRL-V switches to Overwrite: what you type replaces the characters under the cursor, which is handy for changing a word the same length. CTRL-V again switches back. The status line always says which you are in.
ENTER in the middle of a line splits it in two at the cursor. DELETE at the very start of a line joins it on to the end of the line above. CTRL-N splits the line too but leaves the cursor where it was, which is the quick way to open up an empty line to type into.
CTRL-Q CTRL-F finds a piece of text. The status line asks:
Find:
Type what you are looking for, press ENTER, and it asks:
Options:
Press ENTER for none. The cursor jumps to just after the next place the text appears. CTRL-L finds the next one, and the next. When there are no more, the status line says
Search string not found. Press <ESC>
and waits for ESC.
The search is exact about capitals: looking for Hello will not find hello. Give the option U and it will find both.
CTRL-Q CTRL-A asks for the text to find, then
Replace with:
then Options:. With no options it goes to the next match and asks
Replace (Y/N):
Y changes that one; N leaves it. To change every match in the program without being asked each time, give the options GN - G for the whole program, N for no questions. Use that with some care: it does exactly what you said, everywhere.
A block is a piece of text you have marked, from one character to the whole program, so that you can copy it, move it or delete it in one go.
| Keys | Does |
|---|---|
| CTRL-K CTRL-C | Copies the block to the cursor |
| CTRL-K CTRL-V | Moves the block to the cursor |
| CTRL-K CTRL-Y | Deletes the block |
You cannot see a block on the Einstein. Turbo shows a marked block only if it has been told how to draw text dimmed, and the course disc's Turbo has not, so the marks are invisible. Keep track of where you put them. After a copy, the marks are round the new copy - so CTRL-K CTRL-Y straight afterwards deletes the copy, not the original.
After ENTER, and after the CTRL-K commands, the editor has work to do on the screen, and a key pressed in about the first second can be lost. Type straight on after ENTER and the first letter or two of the next line may simply not be there. It is not your typing. Let the screen settle - a heartbeat - before you type the next line, and if a line has lost its first letters, DELETE is no use; put them back.
program Find;
begin
Writeln('Hello');
Writeln('hello');
Writeln('Goodbye');
Writeln('Hello again');
end.
Type it in, run it, and then use it to try every command in this section. Nothing here can harm it that CTRL-Q CTRL-L or retyping cannot mend - and before you start, press S so that you can always load it again.
Starting from
Turbo freshly started, Y, a work file called FIND, CAPS LOCK pressed once.
What you should see
Hello
hello
Goodbye
Hello again
hello with no options, then again with the option U. Which lines does each find?Goodbye, press CTRL-V and type Welcome. What happened to Goodbye, and what does the status line say? Now what does CTRL-V do?Goodbye line with CONTROL and -. Now press CTRL-Q CTRL-L. Does it come back?5.1 In this section's program, change every Hello to Howdy with one command, without being asked about each. What does the program print now?
5.2 Type this program:
program Order;
begin
Writeln('one');
Writeln('two');
Writeln('three');
end.
Using a block, move the Writeln('one'); line so that the program prints two, three, one.
5.3 Load your HELLO program from S4. Using a block, make it print Hello, Einstein four times - without typing the line again.
Worked solutions are in Appendix II.
| Symptom | Cause |
|---|---|
| The first letters of a line are missing | You started typing before the editor had finished with the ENTER. Give it a moment after each ENTER. |
| A CTRL-K command seems to have done nothing | Its keys came too soon after the one before. Press it again, a little more slowly. |
| Text you type eats what is already there | You are in Overwrite - the status line says so. CTRL-V. |
Search string not found. Press <ESC> | There are no (more) matches after the cursor. ESC; CTRL-Q CTRL-R to go to the top and look again. |
| A search does not find something you can see | Capitals differ. Use the option U. |
| CTRL-K CTRL-C copied nothing, or the wrong thing | The block's marks are not where you think; you cannot see them. Mark it again, both ends. |
| A line you deleted will not come back | CTRL-Q CTRL-L only restores a line you changed and are still on. |
The arrow keys type [ ] ^ | They do on the Einstein. Use the diamond. |
The diamond - CTRL-E, S, D, X - moves the cursor; A and F go by words, R and C by screens, and CTRL-Q in front goes all the way. DELETE, CTRL-G, CTRL-T, CTRL-Q CTRL-Y and CONTROL-- delete ever more; CTRL-Q CTRL-L undoes changes to a line you are still on. CTRL-V switches Insert and Overwrite. CTRL-Q CTRL-F finds, CTRL-L finds again, CTRL-Q CTRL-A replaces. CTRL-K CTRL-B and CTRL-K CTRL-K mark a block, which you cannot see, to copy, move or delete.
S6, Keeping Your Work - saving, what happens to the old copy, working on more than one program, and a program that runs without Turbo at all.