An important part of any editor is the capability of loading multiple files simultaneously with the possibility of easily manipulating the files, removing parts of one to add them to another file as desired. Such operations are generally called cutting and pasting operations in obvious analogy with what can be done when working with paper. In some editors (and sometimes here) the cutting operation is referred to as yanking. As previously mentioned, stedi provides ten different buffers for such flexibility. Eight of these can be freely loaded with files for editing, cutting and pasting. The ninth and tenth buffers are used as cut and paste buffers, also called the yank buffers. You can move between buffers with the Alt-# command where # is a number from 0 to 9 (0 standing for 10) indicating the buffer to which you want to move.
For example, if you are editing a program and a couple of subroutines, you can put them in buffers 1, 2 and 3. Suppose you want to load a fourth program in order to copy a few lines of code from it into the program you are currently editing in buffer 1, you can load this fourth program in buffer 4 and copy the lines desired into the `paste' buffer (buffer nine by default or buffer ten) using the copy command. After this, these lines from the paste buffer can be copied to the desired place in your program in buffer 1 using the paste command. The copy and paste commands are easily accessed through the function keys.
The number and size of the files you can keep in the buffers at any given time is only limited by the amount of memory available in the computer. It makes no difference how many of the buffers are used; only the total memory matters. In this section you will learn how to use the yank, copy and paste commands and how to move back and forth among the buffers. In addition, cutting, copying and pasting in relation to specific columns will also be illustrated. The Marked Range
First let us introduce the concept of a `marked range' which is useful for various purposes. A mark can be set in a file using the F1 key.
A marked range is the range of text between the cursor and the mark. The range does not depend on the order of the mark and the cursor but starts with the character under the opening cursor/mark and ends with the character just before the second mark/cursor.
The marked range is important because all cut and copy actions are defined by this range (among other things). The cut (yank) command and the copy command of a marked range are executed by the keys F3 and F4 respectively. Now for example, to mark the range in which the word `printf' is:
One final point about paste buffers: Remember that buffer 9 and 10 can be used as regular buffers for editing purposes. If you are using either buffer 9 or 10 as a regular buffer, then the editor automatically sets the other buffer as the default for cutting and pasting purposes. So if you move to buffer 9, the default paste buffer becomes buffer 10. You can see this change by watching the `Y' in the message bar. An upper case `Y' indicates that 9 is the current paste buffer and a lower case `y' indicates that it is buffer 10.
For editing in one of the buffers 1 through 8, you can set the paste buffer to use by pressing Ctrl-Y which toggles between the buffers 9 and 10. The `block' cut and paste The possibility exists as well for a `block' cut and paste which is restricted to specific columns which are also specified by the position of the mark and of the cursor. The block yank, copy and paste operations are performed with the use of the function keys shift-F3, shift-F4 and shift-F5 instead of F3, F4 and F5, the normal yank, copy and paste command keys.
With these commands, only the box of rows and columns defined by the mark and cursor will be cut. It should also be mentioned that although the order of the mark and cursor doesn't matter for cutting purposes, an immediate `undo' can only be accomplished if the cursor occurs first. (If you had set the mark in the first position for cutting and only realize afterwards that you need to undo the action and paste the column back, you must re-position the cursor back at the beginning of the original block before you paste). The `Clear Buffer' One final command associated with buffers is the `clear buffer' command which is shift-F9. This command simply clears the current buffer. If the contents of the buffer have changed during the edit session (i.e. the `dirty bit' is on), the programmer will be queried before the action is taken.
This clearing action can be undone using the <Undo> key. In other words, after you press shift-F9, the editor puts the contents of the current buffer in a hidden `undo' buffer. Since the contents of this `undo' buffer will take up space in the computer's memory, if you are having memory problems, you may need to press shift-F9 again to clear the `undo' buffer. (What you are actually doing by this action is copying the contents of the - now empty - current buffer into it and therefore effectively clearing it.) For details on this and other aspects of the stedi's memory usage, see the section on `Memory Usage', in this manual.
Command | Action |
F1 | Places a Mark at the point of the cursor. |
F2 | Exchanges the cursor with the mark. |
F3 | Yank (or Cut) the contents of the marked |
range to the current yank buffer. (The | |
contents are removed from the file being | |
edited.) | |
F4 | Copy the contents of the marked range to |
the current yank buffer. (The contents are | |
not removed from the file being edited.) | |
F5 | Paste the contents of the current yank |
buffer to the position of the cursor. | |
sh-F1 | Delete the mark. |
sh-F2 | Go to the mark. |
sh-F3 | Yank a block of text to the current yank |
buffer. | |
sh-F4 | Copy a block of text to the current buffer. |
sh-F5 | Paste a block of text at the current |
position of the cursor. |