1.3.3. Detailed Description of Commands

page037 Command and Mode

At the Edit level there are many options, some of which are referred to as commands and some as modes depending upon the appearance of the prompt. If an option executes a task and returns control to the Edit level, that option is called a command. If an option issues a prompt and gives the user another level of options, it is called a mode. On entering or returning to the Edit level, the Editor redisplays the “Edit:” prompt line.

Repeat Factors

Most of the commands allow repeat-factors. A repeat-factor is applied to a command by typing a number immediately before issuing the command which is then repeated for the number of times indicated by the repeat-factor. For example: typing “2 <down-arrow>” will cause the <down-arrow> command to be executed twice, moving the cursor down two lines. Commands which allow a repeat-factor assume the repeat-factor to be 1 if no number is typed before the command. A ‘I’ typed before the command implies an infinite number.

The Cursor

It should be pointed out that the cursor is never really “at” a character. The cursor is only allowed to be “between” characters. For instance, if the cursor looks as though it is at the letter “R”, it is actually between the letter “R” and the letter in front of it. This is noticed most clearly on the insert command as it inserts in front of the character the cursor was “at”. On the screen the cursor is placed “at” “R” to make it easier to display.

Direction

Certain commands are affected by direction. If the direction is forward, then they operate forward through the file, that being the standard direction of reading English. Backwards is the reverse direction. When direction affects the command it is specifically noted.

Moving Commands

page038

<down-arrow> Moves down
<up-arrow> Moves up
<right-arrow> Moves right
<left-arrow> Moves left
<” or “,” or “- Changes the direction to backward
>” or “.” or “+ Changes the direction to forward
<space> Moves direction
<back-space> Moves left
<tab> Moves direction to the next position which is a multiple of 8 spaces from the left side of the screen
<return> Moves to the beginning of the next line

The arrow, “<” or “>”, in front of the prompt line always indicates direction; “<” for backward and “>” for forward. On entering the Editor, the direction is forward. The direction can be changed by typing the appropriate command whenever the “Edit:” prompt line is present. The period and the comma can also be used because on many standard keyboards, “.” is lower-case for “>” and “,” is the lower-case for “<”.

Repeat-factors can be used with any of the above commands.

For user convenience, the Editor maintains the column position of the cursor when using <up-arrow> and <down-arrow>. When the cursor is outside the text, the Editor treats the cursor as though it were immediately after the last character, or before the first, in the line.

Jump

Jump mode is reached by typing “J” for J(mp while at the Edit level. On entering JUMP mode the following prompt line appears:

>JUMP: B(eginning E(nd M(arker <esc>
Typing “B” (or “E”) moves the cursor to the beginning (or the end) of the file, displays the edit prompt line and the first (or last) page of the file. Typing “M” causes the Editor to display the prompt line:
Jump to what marker?

Miscellaneous commands

Page

The Page command is executed by typing “P” while at the Edit level. Depending on the direction of the arrow at the beginning of the prompt line, the Page command moves the cursor one whole screenful up or down. The cursor always moves to the start of the line. A <repeat-factor> may be used before this command for moving several pages.

page039 Equals

The Equals command is executed by typing “=” while at the Edit level. It causes the cursor to jump to the beginning of the last section of text which was inserted, found or replaced from anywhere in the file. Equals works from anywhere in the file and is not direction sensitive. An INSERT, FIND or REPLACE cause the absolute position of the beginning of the insertion, find or replacement to be saved. Typing ‘=’ causes the cursor to jump to that position. If a copy or a deletion has been made between the beginning of the file and that absolute position, the cursor will not jump to the start of the insertion as that absolute position will no longer be correct.

Text Changing Commands

Insert

The Insert mode is reached by typing “I” for “I(nsrt” while at the Edit level. On entering INSERT mode the following prompt line appears:

>Insert: Text {<bs> a char,<del> a line} [<etx> accepts, <esc> escapes]
One of the options here is to type in text followed by <esc> or <etx>. It is possible to delete a character without leaving the INSERT mode by back-spacing over it. To delete the entire line just typed, type <del>. The INSERT prompt line indicates these by “<bs> a char” and “<del> a line”.

Typing <return> INSERT starts a new line at the level of indentation specified by the options turned on in Environment section of the SET mode. See the section on the SET mode in order to set these options.

Auto-Indent

If Auto-indent is True, a <return> causes the cursor to start the next line with an indentation equal to the indentation of the line above. If Auto-indent is False, a <return> returns the cursor to the first position in the next line. Note: if Filling is True, the first position is the Left-margin. Unless the line above is blank, in which case the first position is that of Paragraph margin.

Filling

If Filling is True, the Editor forces all insertions to be between the right and left margins by automatically inserting <return>'s between “words” whenever the right margin would have been exceeded and by indenting to the Left-margin whenever a new line is started. The Editor considers anything between two spaces or between a page040 space and a hyphen to be a word.

If both Auto-indent and Filling are True, Auto-indent controls the Left-margin while Filling controls the Right-margin. The level of indentation may be changed by using the <space> and <backspace> keys immediately after a <return>. Important: This can only be done immediately after a <return>.

Example 1: With Auto-indent true, the following sequence creates the indentation shown in Figure 3.1.

ONE”, <return>, <space>, <space>, “TWO”, <return>, “THREE”, <return>, <backspace>, “FOUR”.

Figure 3.1
ONE
Original indentation
  TWO
Indentation changed by <space> <space>
  THREE
<return> causes auto-indentation to level of line above
 FOUR
<backspace> changes indentation from level of line above

Example 2: With Filling True (and Auto-indent False) the following sequence creates the indentation shown in Figure 3.2:

ONCE UPON A TIME THERE- WERE”.
(Very narrow margins have been used for simplicity.)
Figure 3.2
ONCE UPON A
Auto-returned when next word would exceed margin
TIME THERE-
Auto-returned at hyphen
WERE
 
           ^
Level of left margin

The cursor may be forced to the left margin of the screen by typing the ASCII control code DC1 (Generated by <CTRL-Q>).

Filling also causes the Editor to adjust the margins on the portion of the paragraph following the insertion. Any line beginning with the Command character (see SET mode) is not touched when filling does this adjustment and that line is considered to terminate the paragraph.

page041 The direction does not affect the INSERT mode, but is indicated by the direction of the arrow on the prompt line.

If an insertion is made and accepted, that insertion is available for use in the COPY mode. However, if <esc> is used, there is no string available for COPY.

Delete

DELETE mode is reached by typing “D” for “D(lete” while at the Edit level. On entering DELETE mode the following prompt line appears:

>Delete: < > <Moving commands> {<etx> to delete, ,<esc> to abort}
In order to delete, the cursor must be in position at the first character to be deleted. On typing “D” and entering DELETE, the Editor remembers where the cursor is. That position is called the anchor. As the cursor is moved from the anchor using the normal moving commands. Text in its path will disappear. To accept the deletion, type <etx>; to escape, type <esc>.

Example:

In Figure 3.3:

  1. Move the cursor to the “E” in END.
  2. Type “<” (This changes the direction to backward)
  3. Type “D” to enter DELETE mode.
  4. Type <ret> <ret>. After the first return the cursor moves to before the “W” in WRITELN and “WRITELN('TO BE.');”disappears. After the second return the cursor is before the “W” in WRITE and that line has disappeared.
  5. Now press <etx>. The program after deletion appears as is shown in Figure 3.4.

The two deleted lines have been stored in the copy buffer and the cursor has returned to the anchor position. Now use the COPY mode to copy the two deleted lines at any place to which the cursor is moved.

Figure 3.3
PROGRAM STRING2;
BEGIN
WRITE('TOO WISE ');
WRITELN('TO BE.')
END.

Figure 3.4
PROGRAM STRING2;
BEGIN

END.

page042 The <repeat-factor> may also be used to delete several lines at once by prefacing a <return> or any other of the moving commands with a <repeat-factor> while in delete mode.

Zap

The ZAP command is executed by typing “Z” for Z(ap while at the Edit level. This command deletes all text between the start of what was previously found, replaced or inserted and the current position of the cursor. This command is designed to be used immediately after one of the FIND, REPLACE or INSERT commands. If more than 80 characters are being zapped the editor will ask for verification.

The position of the cursor where what was previously found, replaced, or inserted is called the “equals mark”. Typing the ‘=’ key will place the cursor exactly there.

Repeat-factors and Zap: If a FIND or a REPLACE is made with a repeat factor and then ZAP, only the last find or replacement will be zapped. All others will be left as found or replaced.

Whatever was deleted by using the ZAP command is available for use with the COPY mode, unless the editor has stated otherwise.

Copy

The COPY mode is executed by typing “C” for C(opy while at the Edit level.

On entering the Copy mode the following prompt line is displayed:

>COPY: B(uffer F(ile <esc>
To copy text from another file, type “F” and another prompt will appear:
>COPY: FROM WHAT FILE[MARKER,MARKER]?
Any file may now be specified, .TEXT is assumed. In order to copy part of a file, two markers can be set to bracket the desired text. If [ ,marker] or [marker, ] is used, the file will be copied from the start to the marker, or from the marker to the end. Use of the copy command does not change the contents of the file being copied from.

page043 To copy the text in the copy buffer, type “B” and the Editor immediately copies the contents of the copy buffer into the file at the location of the cursor when “C” was typed. Use of the copy command does not change the contents of the copy buffer.

On the completion of the copy command in either mode the cursor returns to immediately before the text which was copied.

The copy buffer is affected by the following commands:

  1. DELETE: On accepting a deletion, the buffer is loaded with the deletion; on escaping from a deletion the buffer is loaded with what would have been deleted.
  2. INSERT: On accepting an insertion the buffer is loaded with the insertion; on escaping from an insertion the copy buffer is empty.
  3. ZAP: If the ZAP command is used the buffer is loaded with the deletion.
The copy buffer is of limited size. Whenever the deletion is greater than the buffer available, the Editor will issue a warning upon typing <etx> with the line:
There is no room to copy the deletion. Do you wish to delete anyway? (y/n)

Exchange

EXCHANGE mode is reached by typing “X” while at the Edit level. On entering EXCHANGE mode the following prompt line appears:

>eXchange: TEXT {<bs> a char} [<esc> escapes; <etx> accepts]
EXCHANGE mode replaces one character in the file for each character of text typed. For example in the file in Figure 3.5 with the cursor at the “W” in WISE, typing “X”, followed by typing “SM” will replace the “W” with the “S” and then the “I” with the “M” leaving the line as shown in Figure 3.6 with the cursor before the second “S”.
Figure 3.5
WRITE('TOO WISE ');

   Figure 3.6
WRITE('TOO SMSE ');

Typing a <back-space> (<bs>) will back the cursor one character and cause the original character in that position to reappear. As with most other commands, when in EXCHANGE mode, <esc> leaves the mode without making any of the changes indicated since entering the mode, while <etx> makes the changes part of the file.

page044 Note: Exchange does not allow typing past the end of the line or typing in a carriage return.

Find and Replace

In both modes the use of a <repeat-factor> is valid and must be typed before typing “F” or “R”. The <repeat-factor> appears in brackets on the prompt line.

Strings: Both modes operate on delimited strings. The Editor has two string storage variables. One, called <targ> by the prompt lines, is the target string and is referred to by both commands while the other, called <sub> by the prompt line, is the substitute and is used only by REPLACE. The following rules apply to both these strings.

Delimiters: Both delimiters of the string will be the same. For example: When in REPLACE mode the following command is valid and will replace the first occurrence of the character “[” with the character “]”: “<[<)])”. Here “<” and “)” are the delimiters.

The Editor considers any character which is not a letter or a number to be a delimiter.

Direction: Both modes operate from the position of the cursor to scan the text in the direction indicted by the arrow on the prompt line. The target pattern can only be found if it appears in that section of the text. See the section on direction in order to change the arrow.

Literal and Token mode: In Literal mode, the Editor will look for any occurrences of the target string. If you are in Token mode the Editor will look for isolated occurrences of the target string. The Editor considers a string isolated if it is surrounded by any combination of delimiters. For example, in the sentence “Put the book in the bookcase.”, using the target string “book”, literal mode will find two occurrences of “book” while token mode will find only one, the word “book” isolated by the delimiters <space> <space>.

To use token mode, type “T” after the prompt line and before the target string; to use literal mode, type “L”. The default value found in the Environment may be over-ridden by typing “L” or “T” as appropriate. Token mode ignores spaces within strings so that both “( ',' )” and “(',')” are considered to be the same string.

The Same option: In both commands typing “S” indicates to the Editor that it is to use the same string as used previously. For example, typing “RS/<any-string>/” causes the REPLACE mode to use the previous target string, while typing “R/<any-string>/S” causes the previous substitute string to be used.

page045 Note: The S(et-E(nvironment mode displays the current target and substitution strings.

Find

FIND mode is reached by typing “F” while at the Edit level. On entering Find mode one of the prompt lines in Figure 3.7 appears.

Figure 3.7

>Find[1]: L(it <target> =>
>Find[1]: T(ok <target> =>

The FIND mode finds the n-th occurrence of the <target> string starting with the current position and moving in the direction shown by the arrow at the beginning of the prompt line. The number “n” is the <repeat-factor> and is shown on the prompt line in the brackets “[]”.

Example 1: In the STRING1 program with the cursor at the first “P“ in PROGRAM STRING1 type “F”. When the prompt appears type “'WRITE'”. The single quote marks must be typed. The prompt line should now appear as:

>Find[1]: L)it <target> =>'WRITE'

After typing the last quote mark the cursor jumps to immediately after the “E” in the first WRITE.

Example 2: In the STRING1 program with the cursor at the “E” of “END.” Type: “<” “3” “F”. This will find the 3rd (“3”) pattern in the reverse (“<”) direction. When the prompt line appears type /WRITELN/. The prompt line should read:

<Find[3]: L)it <target> =>/WRITELN/

The cursor will move to immediately after the “N” in WRITELN.

page046

Figure 3.8
PROGRAM STRING1;
BEGIN
  WRITE('TOO WISE 0;
  WRITE('YOU ARE');
  WRITELN(',');          (* Cursor finishes in this line *)
  WRITELN('TOO WISE ');
  WRITELN('YOU BE.')
END.                     (* Cursor starts in this line *)

Example 3: On the first find we type “F/WRITE/”. This locates the first “WRITE”. Now typing “FS” will make the prompt line flash:

>Find[1]: L)it <target>  =>S
and the cursor will appear at the second WRITE.

Replace

REPLACE mode is reached by typing “R” while at the Edit level. On entering REPLACE mode one of the two prompt lines in Figure 3.9 appears. In this example, a <repeat-factor> of four is assumed.

Figure 3.9
>Replace[4]: L(it V(fy <targ> <sub> =>
>Replace[4]: T(ok V(fy <targ> <sub> :>

Example 1: Type “RL/QX//YZ/” which make the prompt line appear as:

>Replace[1]: L)it V)fy <targ> <sub> =>L/QX//YZ/
This command will change: “VAR SIZEQX: INTEGER;“ to “VAR SIZEYZ: INTEGER;”. Literal mode is necessary because the string QX is not a token but is part of the token SIZEQX.

Example 2: In Token mode REPLACE ignores spaces between tokens when finding patterns to replace. For example, using the lines on the left hand side of Figure 3.10 and typing: “2RT/(',')/.LN.” The prompt line should appear as:

>Replace: L)it V)fy <targ> <sub> =>/(',')/.LN.

page047 Immediately after the last period was typed those two lines would change to those on the right hand side.

Figure 3.10

  
WRITE(',');  WRITELN;
WRITE( ',');  WRITELN;

  

V)fy

The verify option permits examination of the <targ> string (up to the limit set by the repeat factor) and deciding if it is to be replaced. The following prompt line appears whenever REPLACE mode has found the <targ> pattern in the file and verification has been requested:

>Replace: <esc> aborts, 'R' replaces, ' ' doesn't

Typing an “R” at this point will cause a replacement while typing a space will cause the REPLACE mode to search for the next occurrence provided the <repeat-factor> has not been reached. The <repeat-factor> counts the number of times an occurrence is found, not the number of times you actually type “R”. Use “/” as a <repeat-factor> in order to examine every occurrence of the target string. If the Editor can not find the target string the number of times specified, the prompt:

ERROR: Pattern not in the file Please press <spacebar> to continue.
appears.

Formatting Commands

Adjust

ADJUST mode is reached by typing “A” while at the Edit level of Command. On entering ADJUST mode the following prompt line appears:

>Adjust: L(just R(just C(enter <left,right,up,down-arrows> {<etx> to leave}

The ADJUST mode is designed to make it easy to adjust the indentation. On any line the <right-arrow> and <left-arrow> commands move the whole line. Each time a <right-arrow> is typed the whole line moves one space to the right. Each <left-arrow> moves it one to the left. When the line is adjusted to the desired indentation press <etx>, <esc> cannot be used.

page048 In order to adjust a whole sequence of lines, adjust one line, then use <up-arrow> (<down-arrow>) commands and the line above (below) will be automatically adjusted by the same amount.

Repeat-factors are valid when used before any of the <arrow> commands while in ADJUST mode, including ‘/’.

ADJUST mode can also center or justify text. Typing “L” while in ADJUST mode will cause the line to be left-justified to the margin set in the Environment. Similarly typing “R” right-justifies to the set margin and typing “C” will cause the line to be centered between the set margins. Typing <up-arrow> (or <down-arrow>) will cause the line above (below) to be adjusted to the same specification (left-justified, right-justified or centered) as the previously adjusted line.

Margin

The MARGIN command is executed by typing “M” while at the Edit level. MARGIN is an Environment dependent command, that is, it may only be executed when Filling is set to True and Auto-indent is set to False. The prompt for the MARGIN command does not appear on the “>Edit:” line.

There are three parameters used by the command: Right-margin, Left-margin and Paragraph-margin. MARGIN deals with one paragraph and realigns the text to compress it as much as possible without violating the above three margins. See the Environment option under the SET mode for how to set the margin values.

Example: The paragraph in Figure 3.13 has been MARGINed with the parameters on the left while the sane paragraph in Figure 3.14 has been MARGINed with the parameters on the right.

Left-margin 0  Left-margin 10
Right-margin 72Right-margin 70
Paragraph-margin 8Paragraph-margin 0

page049

Figure 3.13
This quarter, the equipment is different, the course materials
are substantially different, and the course organization is different
from previous quarters.  You will be misled if you depend upon a friend
who took the course previously to orient you to the course.

Figure 3.14
This quarter, the equipment is different, the course materials are
          substantially different, and the course organization is
          different from previous quarters. You will be misled if
          you depend upon a friend who took the course previously to
          orient you to the course.

A paragraph is defined to be something occurring between two blank lines beginning or end of file, or a line which starts with the command character. To MARGIN a paragraph move the cursor to anywhere in that paragraph and type “M”. When doing an exceptionally long paragraph it may take several seconds before the routine is ready to redisplay the screen. Margin works with blanks and hyphens to do its splitting. All other characters in sequence are considered words. It does not know how to hyphenate words itself.

Command Characters

Portions of the text can be protected from being MARGINed by the use of the Command character. If the Command character appears as the first non-blank character in a line then that line is protected from the MARGIN command. The MARGIN command treats a line beginning with the command character as though it were a blank line, that is, it will consider that line to terminate (begin) the paragraph.

Warning: do not use the MARGIN command when in a line beginning with the Command character.

Miscellaneous Commands

Set

SET mode is entered by typing “S” while at the Edit level. The prompt for the SET command does not appear on the “>Edit:” prompt line due to space limitations. On entering the SET mode the following prompt line appears:

>Set: M(arker E(nvironment <esc>

page050 M(arker:

When editing, it is particularly convenient to be able to jump directly to certain places in a long file by using markers set in the desired places. Once set, it is possible to jump to these markers using the M(arker option in the JUMP mode. When in the SET mode, type “M” for M(arker and the following prompt line appears:

Name of marker?

The name may be up to 8 characters followed by a <return>. Marker names are case sensitive so that lower and upper cases of the sane letter are considered to be different characters. The marker will be entered at the position of the cursor in the text; therefore, first move the cursor to the desired position before setting the marker. (If the marker already existed, it will be reset.)

Only a limited number of markers are allowed in a file at any one time. If on typing “SM”, the prompt:

Figure 3.15
Marker ovflw.
Which one to replace.
0) name1
1) name2
...
9) name10

appears, it is necessary to eliminate one in order to replace it. Choose a number 0 thru 9, type that number and that space will now be available for use in setting the desired marker.

If a copy or deletion is made between the beginning of the file and the position of the marker, a jump to that marker may not subsequently return to the desired place as the absolute position has changed.

E(nvironment:

The Editor enables the user to set the environment which the user determines to be most convenient for the editing being done. When in the SET mode type “E” for E(nvironment, the screen display is replaced with the following prompt shown in Figure 3.16.

page051

Figure 3.16
>Environment: {options} <etx> or <sp> to leave
    A(uto indent  True
    F(illing      False
    L(eft margin  0
    R(ight margin 79
    P(ara margin  5
    C(ommand ch   ^
    T(oken def    True

    7436 bytes used, 1202O available

    Patterns:
      <target>= 'xyz', <subst>= 'abc'

    Date Created: 4-13-55  Last Used: 12-28-78

By typing the appropriate letter, any or all of the options may be changed. The options shown are the default options for the Editor on most screens. Implementations for other machines may have different defaults.

The Options:

A(uto indent:

Auto-indent affects only the INSERT mode of the Editor. Auto-indent is set to True (turned on) by typing “AT” and to False (turned off) by typing “AF”.

F(illing:

Filling affects the INSERT mode and allows the MARGIN command to function. Filling is set to True (turned on) by typing “FT” and to False by typing “FF”.

L(eft margin
R(ight margin
P(ara margin:

When Filling is True the margins set in the Environment are the margins which affect the INSERT mode and the MARGIN command. They also affect the Center and justifying commands in the ADJUST mode. To set the Left-margin, type “L" followed by a positive integer and a <space>. The positive integer typed replaces the old value for the L(eft margin in the prompt shown in Figure 3.16. All positive integers with less than four digits are valid margin values.

page052 C(ommand ch:

The command character affects the MARGIN command and the Filling option in the INSERT mode as described in those sections. Change command characters by typing “C“ followed by any character. For example typing “C*” will change the command character to “*”. This change will be reflected in the prompt.

T(oken def:

This option affects FIND and REPLACE. Token is set to True by typing “TT” and to False by typing “TF”. If Token is True, Token is the default and if Token is False, Literal is the default.

Verify

The VERIFY command is executed by typing “V” while at the Edit level. The status of the Editor is verified by redisplaying the screen. The Editor attempts to adjust the window so that the cursor is at the center of the screen.

Quit

QUIT mode is reached by typing “Q” while at the Edit level. On entering QUIT mode the screen display is replaced by the following prompt:

Figure 3.17
>Quit:
     U(pdate the workfile and leave
     E(xit without updating
     R(eturn to the editor without updating
     W(rite to a file name and return

One of the four options must be selected by typing “U”, “E”, “R” or “W”.

U(pdate:

This causes the Editor to write the file just modified into the workfile and store it as SYSTEM.WRK.TEXT. It is available for either the Compile or Run options or for the Save option in the Filer. The Filer treats SYSTEM.WRK.TEXT as text file.

page053 E(xit:

This causes the Editor to leave without making any changes in SYSTEM.WRK.TEXT. This means that any modifications made since entering the Editor are not recorded in the permanent workfile. All editing during the session is irrecoverably lost.

R(eturn:

This option returns to the Editor without updating. The cursor is returned to the exact place in the file it occupied when “Q” was typed. Usually this command is used after unintentionally typing “Q”.

W(rite:

This option puts up a further prompt:

Figure 3.18
>Quit:
Name of output file (<cr> to return) -->

The modified file may now be written to any file name. If it is written to the name of an existing file, the modified file will replace the old file. This command can be aborted by typing <return> instead of a file name and return will be to the Editor. After the file has been written to disk, the Editor will display the following:

Figure 3.19
>Quit
Writing.....
Your file is 1978 bytes long.
Do you want to

E(xit from or

R(eturn to the Editor?

Typing “E” exits from the Editor and returns to the Command level while typing “R” returns the cursor to the exact position in the file as when “Q” was typed. page054


This page last regenerated Sun Jul 25 01:11:47 2010.