Driving the Dyalog APL tty version
The session window always occupies the whole of the APL "screen"; it may however be obscured by other windows. The session shows the expressions that have been entered, along with any output generated by those expressions. History cannot in general be altered or deleted; it is possible to alter lines in the history, but when Enter (ER) is hit, the altered line is added to the bottom of the history, and the altered line is reset to its original state.
The bottom line of the APL window is reserved for the status line. The status line is considered at all times to be 79 characters wide. It is divided into several fields, whose widths are fixed:
- The string "Search:"
- The current search string
- The string "Replace:"
- The current replace string
- The latest error message (is removed on next keystroke)
- The "name" field: this may contain the name of the workspace, or while in the editor or tracer, the name of the current object
- The name of the current keyboard input mode (see later)
- Whether input is in insert or overwrite (replace) mode
Some error conditions generate text that does not become part of the session, yet is written to the terminal. Additionally, it is possible that other applications may write to the terminal. In such cases, and when the emulator window is resized, it may be necessary to perform a Screen Refresh (SR) which causes APL to rewrite the entire terminal emulator window according to what it believes should be present; this will effectively remove all extraneous text.
The session and the edit and trace windows form a loop; to cycle forwards between windows use the command Windows Tab (TB), to cycle backwards use the command Reverse Windows Tab (BT). At any time you can use the command Jump (JP) to toggle between the current edit/trace window and the session. Escape (EP) closes the current window, having saved any changes (where appropriate); QuiT (QT) closes the current window, but without saving any changes.
It is possible to move and to resize an edit or a trace window; hit Move/Resize (MR) to swap into this mode. In this mode the cursor keys move the current window around (note that when the window reaches the edge of the screen, its size will in many cases reduce as the opposite edge continues to move in the direction of movement. Up one Screen (US), Down one Screen (DS), Left one Screen (LS) and Right one Screen (RS) cause the right or bottom margin to extend or reduce as appropriate. Note that if the right or bottom edge is against the right or bottom edge of the session, then the window is made larger by "pushing" the left or top edge away as applicable.
Trace windows are read-only; however, it is possible to edit the currently traced object by hitting Edit (ED) while the cursor is on the first column of any line or by hitting ED while the cursor is on the name of the object. However, both in the Editor and Trace windows individual breakpoints (aka Stops) can be set and unset using the Toggle Breakpoint (BP) command. The Clear Breakpoints (CB) command will cause all breakpoints in the current object to be cleared. Note that by default there is no visible indication that either of these commands has been run; however, the output from ⎕STOP
will show whether either of these commands has been run. See "Configuring the Editor" for more details.
Edit windows and the session are read-write. By default input lines are in insert mode. It is possible to toggle to overwrite mode by using the Insert Toggle (IN) command. Note that this mode allows you to generate those overstrike APL characters which are supported by Dyalog APL; attempting to overwrite an existing character with one that does not form a valid APL character results in the original character being replaced with the newly-typed one. Destructive Backspace (DB) and Delete Item (DI) delete the character immediately before the cursor and the character under the cursor respectively. It is possible to define keycodes for Insert Item (II) and Non-destructive Backspace (NB) and Non-destructive Space (NS) but these are not in general use. Destructive Space (DP) is mapped to the Spacebar.
In an edit window Toggle Localisation (TL) will add the name currently under the cursor to the end of the header line so as to localise that name if it was not already present in the header; if the name is present in the header, it is removed from the header. Redraw (RD) causes the function to be reformatted, with indentations added etc.
It is possible to move or copy a line or a block of lines from one window to the other. It is also possible to Cut (CT) from the cursor position to the end of the line and to Paste (PT) the cut text; however, there is no other mechanism for selecting parts of a line, although you can use the mouse and the facilities of the terminal window or emulator to move partial lines around. In this case you may find that it is best to have the editor or tracer windows maximised to avoid copying the line drawing characters that form the outline of the edit or trace windows too; Zoom (ZM) toggles windows between maximised and standard size.
Use the Tag (TG) command to select contiguous lines of text; identify the initial line with TG, move to the last line you wish to highlight and hit TG again. The next TG command only removes the tagging from the currently tagged block - it does not clear and initiate another selection. For Copy (CP) or Move (MV) move to the line immediately above where the text is to be placed, and hit CP or MV as appropriate. Use Delete Block (DK) to delete the highlighted lines. Note that it is possible to copy or move text between edit windows and the session.
Comments can be aligned to the column where the cursor is by hitting Align Comments (AC). Comments that appear in columns which precede the first tabstop are aligned to column 1.
Text searches can be made in all windows; the Search (SC) command defines the search string; hitting Enter (ER) to complete the definition also moves the cursor to the next instance of the search string in a forward direction. The Next (NX) and Previous (PV) commands moves the cursor to the next or previous instance of the search string; when there are no more instances in the specified direction the error field will contain either No Match→
or ←No Match
.
Strings can be replaced in the Editor and Session windows; the cursor must be at the start of an instance of the search string. Replace (RP) command is used to specify the replacement string; if the cursor is at the start of an instance of the search string, that instance will be replaced with the replacement string. The Repeat (RP) command (also called Do) is used to make additional replacements. The Repeat All (RA) command will replace all instances of the search string with the replacement string in the current object, both forwards and backwards from the current position; in this case the cursor does not need to be at the start of an instance of the search string.
For both the Search and Replace commands EP is used to clear the definition of the appropriate string; the entire field will be removed from the status line.
Dyalog APL responds to weak and strong interrupts; the kill
operating system command can be used to send a signal 2 (SIGINT) or 3 (SIGQUIT) respectively, or the user can hit the intr or quit keystrokes. The current mappings for these two keystrokes can be seen by running the operating system command stty -a
. The most common keystrokes for intr and quit are Ctrl-C and Ctrl-\ respectively. Note that when using PuTTY it will be necessary to swap out of the APL keyboard to generate these keystrokes.
The tables below show the keystrokes that can be used in the different windows.
Commands Common to all Window Types
Command | Code | Description |
---|---|---|
Cursor Move | LC RC UC DC |
Left/Right/Up/Down one character |
LS RS US DS |
Left/Right/Up/Down one screen | |
LL RL UL DL |
Left/Right/Up/Down to limit in that direction | |
HO | Home Cursor .. to top left hand corner of object | |
Toggle line numbers | LN | Turn line numbers on or off in all trace and edit windows. This can be done from the session too |
Screen Refresh | SR | Causes APL to redraw the session, removing all extraneous text that has come from external sources and resetting the session display |
Window Commands
Command | Code | Description |
---|---|---|
Move between Windows | TB | Move to next window in loop |
BT | Move to previous window in loop | |
JP | Jump - toggle between session and current window | |
Alter Windows | ZM | Zoom - toggle window to full size and back |
MR |
Move/Resize: LC/RC/UC/DC: move window in that direction LS/RS/US/DS: move bottom right hand corner in selected direction relative to top left hand corner EP: exit move/resize mode |
Session Commands
Command | Code | Description |
---|---|---|
Redo/Undo | FD | Show next line in input history |
BK | Show previous line in input history |
Editor Commands
Command | Code | Description |
---|---|---|
Start/Stop | ED | Start Editor |
EP | Fix and Close | |
QT | Abort and Close | |
Fix function | FX | Causes the function to be fixed, without quitting the edit session |
Redo/Undo | FD | Reapply last change |
BK | Undo last change (where possible) | |
Outlines | MO | When on the first or last line of a control structure, move to the opposite end |
TO | Open/Close outlined blocks | |
Toggle local | TL | For traditional functions, the name under the cursor is either added or removed from the list of localised names on the function's header line |
Toggle Breakpoint | BP | Toggles a breakpoint on the current line |
Clear Breakpoints | CB | Clears all breakpoints in the current object |
Open Line | OP | Opens a line underneath the current line; in insert mode moving to the end of the line and hitting ER is equally effective |
Reformat | RD | Causes the function to be reformatted, with corrected indentation etc. |
Comments | AC | Align comments to current column |
AO | Add comment symbol at start of each tagged or current line | |
DO | Remove comment symbol which is first non-space character on each tagged or current line |
Note
- The editor can also be started using
)ED
or⎕ED
. Hitting ED in the session with a suspended function on the stack will open the editor on that function; this is called Naked Edit. - By default, outlines are not shown. See "Configuring the Editor" for further details.
- By default, there is no visual indication that a breakpoint has been set, although
⎕STOP
will show the breakpoints. However, it is possible to view breakpoints - see "Configuring the Editor" for further details. - AO, DO, RD only work in 13.1 onwards
Tracer Commands
Command | Code | Description |
---|---|---|
Start/Stop | TC | Start Tracer |
EP | Cut stack back to calling function; close all windows to match new stack status | |
Execution | ER | Execute current line |
TC | Trace into any and all functions on current line | |
FD | Skip over current line | |
BK | Skip back one line | |
Toggle Breakpoint | BP | Toggles a breakpoint on the current line |
Clear Breakpoints | CB | Clears all breakpoints in the current object |
Continue | RM | Resume Execution - do not show trace windows on next error or stop |
BH | Run to Exit - but show trace windows on error or stop |
Note
- Hitting TC in the session with a suspended function on the stack will open one trace window for each function on the stack; this is called Naked Trace.
- By default, there is no visual indication that a breakpoint has been set, although
⎕STOP
will show the breakpoints. However, it is possible to view breakpoints - see "Configuring the Editor" for further details.
Search and Replace Commands
Command | Code | Description |
---|---|---|
Define string | SC | Search: having hit Search, type string to search for, and ER to find first occurrence. EP clears the field |
RP | Replace: having hit Replace, type string to replace current search with; change will be effective once ER is hit. EP clears the field | |
Find and Replace | NX | Locate next match downwards |
PV | Locate previous match upwards | |
RT | Repeat (Do) the same action again | |
RA | Repeat all - in both directions |
Note
- Applies to session, editor and tracer
- Applies to the session and editor only
- Caution: the Repeat All replaces ALL matches in the current object
Session-related Commands
Command | Code | Description |
---|---|---|
Selection | TG | Tag (highlight) blocks of text. Hit TG on initial line, move to last line to be tagged and hit TG again. Next TG clears the current tagging rather than initiating a new tag |
Block commands | CP | Copy highlighted block to below current line |
DK | Delete highlighted block | |
MV | Move the highlighted block to below the current line | |
Cut and Paste | CT | Cut from current cursor position to end of line |
PT | Paste last Cut text immediately after cursor |
Screen Manager Commands
Command | Code | Description |
---|---|---|
Move between ⎕SM and session/trace/edit windows |
HK | With non-empty ⎕SM , toggle between ⎕SM window and trace/edit/session window. HK is a valid exit key for ⎕SR , but using it as such can be confusing ! |
Exit keys | EP QT ER | Default exit keys for ⎕SR |