previous next top contents index framed top this page unframed
7.1. Character, Word, and Line Delete Buffers
When text is deleted with the D, K, or Z commands,
it is stored into what is called a delete buffer. This text can
then be retrieved using the R commands described in
Section 7.5.
The delete buffers act like pushdown stacks in that text is
recovered in “last in, first out” order.
Separate delete buffers are used to store deleted characters, words, and lines. Each delete buffer can hold up to 2000 objects. When a delete buffer is full, the least recently deleted objects are discarded.
Character, word, and line
delete buffers cannot be displayed in
a MAINEDIT window or edited with regular MAINEDIT commands.
7.2. Page Buffers
Each time a page is deleted with a DP (Delete Page)
command,
it is inserted into a page delete buffer
for possible recall.
The buffer is named <DELETEDPAGES>,
and may be edited like a normal buffer.
The DP command in <DELETEDPAGES>
immediately reinserts the deleted page at the end of the buffer;
..DP must be used to delete a page from <DELETEDPAGES>.
7.3. Delete
The delete commands shown in Table 7–1
remove text from the edit buffer and copy it into a delete buffer.
Table 7–1. Text Deletion Commmands
| Command | Delete: |
|---|---|
| nK | n characters at and after |
| QK | all characters to the end of the line |
| -nK | n characters before |
| -QK | all characters to the start of the line |
| nD[C|W|L|P] | n objects at and after |
| QD[C|W|L|P] | all objects at and after |
| -nD[C|W|L|P] | n objects before |
| -QD[C|W|L|P] | all objects before |
The QDL command deletes up to the next page mark or the end of the current window, whichever comes first; the -QDL command deletes back to the previous page mark or the start of the current window.
The .D command copies text to a delete buffer without removing it from the edit buffer. It can be modified in the same way as shown for the D command in Table 7–1.
The ..D command deletes text without copying it to the delete buffer. It can be modified in the same way as shown for the D command in Table 7–1.
K is a short form equivalent to DC (but .K means “Kill buffers”, quite different from .DC). ..K is equivalent to ..DC.
Text is moved or copied from one place to another by combining the D (Delete) and K (Kill) commands with the R (Recall) command (sometimes called “cut and paste”).
To copy text, use .D to copy the desired objects into the delete buffer, which leaves the edit buffer unaltered. Then move the cursor to the destination location and use R (Recall) to insert the text. To move text instead of copying it, use the D command instead of .D.
Copying and moving text to immediately adjacent parts of the buffer may also be accomplished with the C and M commands, as described in Sections 8.2 and 8.3.
The ..DP form of the delete
page command, which does not insert the
deleted page into <DELETEDPAGES>,
is considerably more efficient than
DP, and so should be used when
you are sure that the page is not going to be recovered.
7.4. Zap
The Z (Zap) command behaves
like the S (Skip) command, except that the characters
or lines that are be skipped by S are deleted by Z.
See Table 7–2.
| Command | Delete to: |
|---|---|
| nZx | nth next occurrence of x on current line |
| -nZx | nth previous occurrence of x on current line |
| +Zx | next occurrence of non-x on current line |
| -+Zx | previous occurrence of non-x on current line |
| QnZx | nth next line with x as first visible character (x may not be <sp>) |
| -QnZx | nth previous line with x as first visible char (x may not be <sp>) |
| +QZx | next line without x as first character |
| -+QZx | previous line without x as first character |
| QnZ<sp> | nth next all-blank line |
| -QnZ<sp> | nth previous all-blank line |
Zapped characters and lines are stored in the character and line delete buffers, respectively. Use the .Z command to copy text into a delete buffer without removing it from the edit buffer. The .Z command can be modified in the same way as the Z command. The ..Z command deletes without copying text into the delete buffer.
QZ<sp> is a convenient way to delete the current “paragraph”,
assuming paragraphs are separated by blank lines.
7.5. Recalling Text
Use the R (Recall) command to remove text from a delete buffer and
insert it at the current cursor location. The recall command is
always followed by an object (character, word, line, or page) that
specifies the delete buffer from which the text is to be copied or
moved.
In each case the recall command inserts the recalled text before the current object. Thus, recalled words, lines, and pages are inserted before the current word, line, or page, respectively, not into the middle of it.
Since character recall does not insert blanks that were not deleted, characters can be recalled into the middle of words. Word recall inserts spaces, if necessary, to separate the inserted text from the surrounding text; multiple blanks are eliminated.
When the R command is given, the number of objects may be specified in any of the three ways shown in Table 7–3.
Table 7–3. Text Recalling (Undeletion) Commands
| Command | Recall and insert: |
|---|---|
| R[C|W|L] | most recently stored group of objects |
| nR[C|W|L|P] | most recently stored n objects |
| QR[C|W|L|P] | all stored objects to delete-buffer mark |
If no count modifier is specified, then the most recently deleted group of objects is recalled. A group of objects has been deleted with a single delete command. For example, 3DW deletes and stores three words from the edit buffer and stores them into the word delete buffer as a single group. A subsequent RW command recovers all three words at once.
If the count modifier is present, then the number of objects specified by the count is recovered, regardless of how the objects are broken into groups. 1RW after a 3DW command recalls only the last word deleted by the 3DW command, leaving the other two words in the group in the word delete buffer.
If the count modifier specifies more objects than are present in the delete buffer, only as many objects as are present are recalled. If there are no objects in the appropriate delete buffer, a recall command has no effect.
The emphasis modifier Q is used to recall all objects up to the last delete-buffer mark. A delete-buffer mark is set with the commands .M[C|W|L]. A message appears on the message line to let you know the mark is set. If no marks have been set, QR[C|W|L] recalls everything in the delete buffer.
Group and delete-buffer mark divisions are not maintained for page delete buffers. An RP command with no count recovers the last deleted page. QRP recovers all pages in all page delete buffers.
The commands
.R[C|W|L|P] may be modified in
the same way as the R[C|W|L|P]
commands. .R inserts objects into the edit buffer without
removing them from the delete buffer, so that the same object
(or group of objects) may be recalled any number of times.
7.6. Recalling Text at Prompts on the Message Line
Typing <ecm> (“enter command mode”) to any prompt on the
MAINEDIT command line pops the top
element of the line delete buffer and
inserts it at the current place on
the message row. If the line buffer is
empty, <ecm> beeps and aborts the
prompt. Several <ecm>s to the same prompt
keep popping more text onto the end of the text so far. You can type
your own text before, in between, and after any of the <ecm>-generated
text.
For example, suppose you have a bunch of files you want to look at with the editor. Get all the file names in a buffer, one per line. To look at the next file, delete the line with its name, and issue a .F command; at the prompt, type <ecm>, which inserts the deleted line onto the message row. Then type <eol> as usual. This works very nicely as part of macros.
Note: this mechanism works for any message line prompt, even, e.g., in MAINDEBUG when invoked from MAINEDIT.