Outside of token input mode, the operation of the
Backspace and Delete
keys will depend on the operator being used in the
parent element of the current expression.
If an operator is declared as an nary operator,
that is, an operator that accepts a variable number of
child elements, then when the current expression
is a child element of such an operator, the
Backspace and Delete
keys operate much as they do for token input mode.
Using the Backspace key removes
child elements to the left of the insertion point, and
using the Delete key removes child elements
to the right of the insertion point. Quite a few operators
are declared as nary operators, including those that accept
optional qualifier elements. The complete list of
nary operators used in Zed is given in paragraphs on
Nary Operators
in the Operators section in the
Reference part of the
Users Guide.
The operation of the
Backspace and Delete
keys works somewhat differently in the context of array operators,
like <matrix>. When the current expression is an element
of the matrix, these keys provide operations for removing rows and columns
of the matrix. Using the Backspace key removes
matrix entries from right to left, bottom to top, from within the matrix, and
using the Delete key removes the column containing
the current expression. These column operations are augmented by
keyboard accelerators for deleting rows of the matrix.
Typing Ctrl+Backspace removes the
array row containing the current expression and moves the
expression cursor to the previous row, while typing the
Ctrl+Delete key removes the
array row containing the current expression and moves the
expression cursor to the next row.
In addition to the uses of the
Backspace and Delete
keys described above, there are two other special operations for removing
structure. For any operator that is being used in the
parent element of the current expression, that
operator can be removed by typing
Shift+Delete. The result of this
operation is that the parent element is completely replaced by
the current expression, that is, the current expression
is moved up in the expression tree.
For associative operators, when the
current expression is an application of the same
operator as is present in the parent element, typing the
Shift+Up key flattens the one level
of grouping implied by the structure of the current expression:
the child elements of the current expression become
child elements of the parent element, removing one level
of structure.