Editing

Many of these editing tips can work for letters in the program, or in the graphics and sound programs.

Selection

In many editors, many letters can be selected by using the mouse and clicking between two letters and dragging the mouse. The selected letters are shown by being "highlighted" in a different color.

Sometimes using the mouse and clicking twice quickly will select a word, and three times will select a line.

When something is selected, many actions can be performed. One common action is to use the Delete key to delete the selection. Another is to copy it as shown here.

Copy and Paste

There may be a line of code like the following and we want most of for another object.

bird = Object(Path(data_dir, 'Bird'))

Like:

cow = Object(Path(data_dir, 'Cow'))

Instead of typing the whole line again and maybe making a mistake, select the letters, and use Ctrl+C to store the letters, and then use Ctrl+V to copy them to a new place.

The Ctrl+C means to Press and hold the "Ctrl" key and press the "C" key while the "Ctrl" key is held down.

Undo and Redo

Sometimes while added lines of code, it is easy to make an mistake. For exmple, there might be some lines like:


    a = 5
    b = a

Then the "b = a" line is selected and the "Delete" key is pressed.

After pressing the "Delete" key and before pressing any other key, use Ctrl+Z to "undo" the delete.

If the "undo" is performed, but you didn't want to use it, use the "redo". Many programs that edit will use Ctrl+Y. The Python editor uses Ctrl+Shift+Z.

If undo was used many times in a row, then redo will redo many of them.

Tab Completion

When using a terminal or console, the Tab key can be used to look for items.

For example, starting from the codeplayfield folder, you can enter "cd fie<Tab>", and the "field" directory should display.

So a more complete example is:

    "cd fie<Tab>ga<Tab><Enter>"
    "python 1<Tab>"
This should fill the lines with the file on the disk starting with "1".