Editing Controls

Modes that Affect the Editing Controls

The mode ERM affects the terminal's response to erase controls:

ERM Erasure Mode (D,6). Permits the erasure of characters regardless of their protected status; see Forms section.

The mode IRM is an editing mode:

IRM Insertion-Replacement Mode (-,4). Permits character entries to be inserted into the Page, pushing the characters presently displayed to the right (instead of overwriting, or replacing, them).

Two controls set internal registers whose settings affect the terminal's response to the controls:

SGR Set Graphic Rendition (ESC [ Ps..Ps m). Sets a Graphic Rendition (GR) register according to the parameters; see Display section, Highlighting the Display. The contents of this register are appended to all characters subsequently entered or received. It is also appended to all Space (2/0) codes written by the Erase controls, inserted by the Edit controls, or inserted as a result of memory scroll; see zSPM (Scroll-Page Mode).

SEE Select Editing Extent (ESC [ Ps Q). Sets an Editing Extent (EE) register according to the parameter. The contents of this register limit the effect of the character edit controls, DCH and ICH, to Page, Line, Field, or Area; see Definitions below.

Definitions

Certain terms are used in describing the Ambassador's editing features. They are defined below to clarify their usage. These definitions follow, and are consistent with, the ANSI definitions.

Page
The portion of Active Memory between the Upper and Lower Host Areas; see Display section. The Page is the only portion of Display Memory that can be accessed, written, or affected (by erase/edit operations) with the primary cursor.
Line
A portion of the Page having a common vertical position. A Line contains columns 1 through 80.
Field
A portion of the Page bounded by tab stops (either columnar or page). A Field contains the character position at the beginning tab stop and excludes the character position at the trailing tab stop. The Ambassador initializes to ten 8-character Fields per Line; see Cursor Controls section, Using Columnar Tabs.
Qualified Area
A portion of the Page bounded by area qualifiers; see Forms section. An Area includes the character position at the beginning area qualifier and excludes the character position at the trailing area qualifier. The Ambassador initializes to one Area (equal to the Page).
Active
Applied to a portion of the Page, refers to the portion that contains the cursor, e.g. the Active Line is the Line that presently contains the cursor.

Erasing the Display

All erase operations consist of writing Space (2/0) codes into the selected regions of memory. Each Space code is tagged with the present setting of the GR-register (see SGR).

Operator Control. The operator may erase portions of the Page with the following keys:

SPACE BAR. Erases the character at the cursor. If zKRM (Key Repeat Mode) is set, it repeats if held down.

BACKSPACE. If zDBM (Destructive Backspace Mode) is set, backspaces and erases the character at that position. If zKRM is set, it repeats if held down.

ERASE. ERASE erases from cursor to end of Line. SHIFT-ERASE erases from cursor to end of Page. This key is programmable on both levels. Its functions may be disabled or changed, if desired; see Programmable Strings section. (Note: In Monitor SRM, i.e. off-line entry, ERASE is confined to the Active Qualified Area, and SHIFT-ERASE will not erase Areas designated as protected regardless of the setting of ERM; see Forms section.)

Host Control. The host may erase portions of the Page with the following controls. The controls ED, EL, EF, and EA erase defined regions; see Definitions above. In addition, each permits one of three selective parameters to further specify whether the erase is to be from cursor to end of region (Ps = 0), from beginning of region to cursor (Ps = 1), or the entire region (Ps = 2).

ED Erase in Display (ESC [ Ps J). Erases some or all of the Page according to the parameter, Ps. Examples:

ESC [ J Erases from cursor to end of Page
ESC [ 1 J Erases from beginning of Page to cursor
ESC [ 2 J Erases the entire Page

EL Erase in Line (ESC [ Ps K). Erases some or all of the Active Line according to the parameter.

EF Erase in Field (ESC [ Pn N). Erases some or all of the Active Field according to the parameter.

EA Erase in Area (ESC [ Ps O). Erases some or all of the Active Qualified Area according to the parameter.

The host may also erase a specified number of characters (up to 255).

ECH Erase Character (ESC [ Pn X). Erases the following Pn characters, starting with the character at the cursor.

Editing the Display

Operator Control. The operator may edit portions of the Page with the following keys:

EDIT. Toggles the terminal into and out of Insertion-Replacement Mode (IRM). In Insertion Mode, character entries are inserted into the Page, pushing the characters presently displayed to the right (instead of overwriting, or replacing them).

Note: If it is desired to have visual feedback that the terminal is in Insertion mode (e.g. during off-line entry), the key may be re-programmed to include the zTFC (Toggle Fast-blink Cursor) control (i.e. ESC 5 ESC 6). This causes the cursor to fast-blink whenever the terminal is put into Insertion mode (with the EDIT key).

DELETE. Deletes the character at the cursor and moves the following characters left to fill the space. SHIFT-DELETE deletes the entire line containing the cursor and moves the following lines up.

INSERT. Moves the character at the cursor to the right, opening a space. SHIFT-INSERT moves the entire line containing the cursor down, opening an empty line.

In all cases, the extent of the Page affected is determined by the Select Editing Extent setting near the end of Setup line D. It should normally be set to 1 (= Line). (Note: In Monitor SRM, i.e. off-line entry, the effect of these keys is confined to the Active Qualified Area regardless of the Select Editing Extent setting; see Forms section.)

The DELETE and INSERT keys repeat when held down, regardless of the setting of zKRM (Key Repeat Mode), unless specifically re-programmed not to repeat. All three keys (including EDIT) are programmable. Their functions may be disabled or changed if desired; see Programmable Strings section.

Host Control. The host may edit portions of the Page with the following controls.

DCH Delete Character (ESC [ Pn P). Deletes Pn characters, starting with the character at the cursor, by shifting the remaining characters (in the editing region) to the left. Character positions vacated at the end of the editing region are erased. Examples:

ESC [ P Deletes 1 character
ESC [ 12 P Deletes 12 characters

ICH Insert Character (ESC [ Pn @). Inserts Pn spaces (2/0) at the cursor by shifting the character at the cursor, and all following characters (in the editing region), to the right. Characters shifted past the end of the editing region are lost.

Instead of using the ICH control to open up a space and then writing into it, the host may put the terminal into the Insertion (set) state of IRM and insert the characters directly. The SM sequence, ESC [ 4 h, puts the terminal into Insertion mode. The RM sequence, ESC [ 4 l, returns it to Replacement mode. (Alternatively, the control zTI, Toggle IRM, ESC 6, may be used. This is the control generated by the operator's EDIT key.)

SEE Select Editing Extent (ESC [ Ps O). Sets an Editing Extent (EE) register according to the selective parameter. The contents of this register limit the effect of the character edit controls, DCH and ICH, and entries in the Insertion state of IRM, to Page (Ps = 0), Line (Ps = 1), Field (Ps = 2), or Qualified Area (Ps = 3); see Definitions above. Examples:

ESC [ O Selects end of Page (as the end of the editing region)
ESC [ 1 O Selects end of Line
ESC [ 2 O Selects end of Field
ESC [ 3 O Selects end of Qualified Area

DL Delete Line (ESC [ Pn M). Deletes the contents of Pn lines, starting with the Active Line, by shifting the remaining lines in the Page upward. Lines vacated at the end of the Page are erased.

IL Insert Line (ESC [ Pn L). Inserts Pn erased lines by shifting the contents of the Active Line, and all following lines, downward. Lines shifted past the end of the Page are lost.

zPSH Push Line (ESC [ Pn s). Moves the contents of Pn lines, starting with the Active Line, to the bottom of the Page, by shifting the bottom lines of the Page upward.

zPOP Pop Line (ESC [ Pn t). Moves the contents of Pn lines at the bottom of the Page to (start at) the Active Line, by shifting the Active Line, and all following lines, downward.

NOTE: The zPSH and zPOP controls permit re-arranging the data in the Page without re-transmitting; see also Display section, Setting Up Multiple Pages.

Using the zSDP Control in Editing

The standard controls provide a great deal of versatility in confining the effects of erase and edit operations to defined regions. The zSDP control extends this versatility even more.

The zSDP control defines the 'Page'. It partitions memory, but does not change its contents; see Display section, Definitions. Erase and edit operations, by definition, act only on the contents of the Page. The zSDP control permits the effect of these operations to be confined to specified lines.

Example:

Assume a 60-line Page, SEE set to 0 (edit to end of Page), and a 9-line paragraph in lines 20 through 28. The zSDP control, ESC [ 28 ; 19 p, narrows the Page to contain only the paragraph. The erase and edit controls now act only on the paragraph; the remaining text is unaffected. When the paragraph has been edited, the zSDP control, ESC [ 60 p, returns the Page to its prior setting.