Editing

Logo provides full editing capability for your files and procedures. In Logo, your commands and procedures are executed as soon as you type them and press the ENTER key. In an edit window, the text of commands and procedures is displayed and can be changed. You can execute these commands by defining them to make them part of Logo. You can then return to the edit window to make any changes you would like. You can also store commands and procedures permanently from an edit window by saving them in a disk file.

The Edit Command

The EDIT command in Logo automatically opens an edit window. When you type EDIT and press ENTER, an empty edit window is opened. You can type the definitions of procedures in the edit window using the mouse and cursor keys to position the cursor until you have written one or more procedures.

If you type EDIT followed by one or more procedure names, an edit window opens containing the text of the specified procedure(s). You can make any changes you like to the definition of the procedure(s) in the edit window.

The Edit Menu offers additional commands that make it convenient to perform editing functions in an edit window.

Defining Edit Window Contents

When you have created or changed procedures in an edit window, you can load them back into Logo to try them out. To do so, choose the Define command from the Edit Menu (or press F2). This command causes the edit window to minimize and loads the contents of the edit window into Logo workspace. You can now try your procedure(s) by typing its name in the Listener and pressing ENTER.

You can also define only some of the text in an Edit Window. For example, to define one procedure of several in an Edit Window highlight the text of the procedure and select Define from the Edit Menu or press F2.

Edit Windows

Logo provides an unlimited number of edit windows for you to use to write, store, and save your procedures. An edit window is similar to the Listener Window in that what you type appears as you type it when the edit window is selected. All of the editing commands that work in the Listener Window also work in edit windows. The difference is that commands you type are not executed when you press ENTER. The information you enter into an edit window, such as procedure definitions, is only entered into the Logo workspace when you choose to define the edit window's contents.

Opening Edit Windows

There are several ways to open an edit buffer in Logo. The EDIT command typed at toplevel causes an edit window to open. The EDIT command by itself opens an empty edit window. If the EDIT command is followed by one or more procedure names, the window displays the definitions of the procedure(s) when it opens. You can open a minimized edit window by double-clicking its icon on the screen. The menu command File/Load automatically opens an edit window and places the contents of the file you choose from the dialog box in it. Once an edit window is open it can be moved, sized, and positioned on the screen with the same commands as any other window.

Edit Window Name Conventions

Logo automatically assigns a name to any edit windows you open. This name is used by Logo until you change it or save the contents of the edit window. If you open an edit window with the command EDIT, the edit window takes the name Editor. If you open an edit window with the EDIT command followed by one or more procedure names, the edit window takes the name of the first procedure in the list. If you open an edit window with the File/Load command, the edit window takes the name of the file you select to load into it.

Files and Edit Windows

Disk files can be loaded directly into and saved directly from edit windows. To load a file from a disk into an edit window, choose Open from the File Menu. This automatically opens an empty edit window and loads the contents of the file you specify in the subsequent dialog box into it. The edit window takes the name of the file as its name. The contents of the file in the edit window can be edited and/or loaded into Logo workspace from the edit window.

The contents of an edit window can be saved directly to disk from the edit window, To save the contents of an edit window and then load the contents into Logo workspace, choose Save and Define from the Edit menu. A dialog box appears in which you can specify the name of the file and where it is to be saved. After the contents of the edit window are saved in the disk file, the contents are loaded into Logo and the edit window is minimized. The name of the edit window is the same as the file name you assign it.

To save the contents of an edit window in a disk file without loading contents into Logo and minimizing the edit window, choose Save or Save as... from the File Menu when the edit window is selected. A dialog box appears in which you can assign the file a name. After the file is saved you can continue to work in the edit window.

The Edit Menu

The Logo edit windows are designed to provide you with a convenient way of developing and working with your Logo programs and procedures. They provide basic text editing functions via the same key combinations as the Listener Window. In addition, the Edit Menu provides additional functions, including the ability to search for and search and replace text strings, append file contents, write partial edit contents to a file, and globally select and/or erase the text in the edit window. You can also define only some of the text in the Edit Window. For example, to define one procedure of several in the Edit Window mark the text of the procedure and select Edit/Define from the Edit Menu or press F2.

Managing Edit Windows

Multiple edit windows are a powerful feature of Logo but require you to think about the best way to use them for your Logo programs and procedures. When you open an edit window and choose to define its contents with F2 or Edit/Define, Logo places the contents of the edit window in workspace and minimizes the edit window. In some cases, it may be useful to keep each procedures in workspace in its own edit window. The minimized edit window icons provide a visual representation of the contents of Logo workspace. To save all of them in a file however, you would need to copy and paste them all together in one edit window and then save its contents with File/Save or Edit/Save and Define. Alternatively, the Logo command SAVE filename saves the entire workspace contents in the specified file.

In other situations, you may want to work with many procedure definitions in an edit window. This makes it convenient to save only some of the procedures in workspace or group procedures according to your preference. The edit windows are designed to provide maximum flexibility for you to adapt your own style of Logo programming.

As a convenience, each time you exit from Logo, you are asked if you want to save the contents of any edit windows that have not already been closed. This is designed to help you avoid losing any of your procedures or programs.