Top  Previous  Next


The KEYEDIT statement defines editing keys for use with INPUT @.





KEYEDIT (action, key), (action, key), ...




actionidentifies the editing action to be performed when the key is pressed. This may be:
2Cursor left
6Cursor right
7Insert character (treated as action 13)
8Delete character
13Toggle insert mode

A negative action value removes the key binding specified by key.


keyidentifies the key to be bound to the given action. This is specified as a numeric value:
1 to 31Use the control key with this character value. Ctrl-A is 1, Ctrl-B is 2, etc.
32 to 159Use the Escape key followed a character value of key - 32 (e.g. Esc-A is 97).
160+Use a sequence of up to four characters constructed from the bytes sent by the key to be trapped starting from the low order byte plus 160. See below for an example.



The KEYEDIT statement adds user defined alternative key bindings to the standard set used by the INPUT @ statement. These may validly replace default bindings. The newly bound keys remain in effect until either they are rebound by a further KEYEDIT statement or the process returns to the command prompt.


The INPUT @ statement checks for keys bound via the terminfo system or KEYEDIT before using the standard default bindings.



Example  of a multi-byte key sequence


The F2 key of a vt100 terminal using the vt100-at definition with AccuTerm sends a three character sequence of "Esc O Q". The hexadecimal values of these characters are 1B, 4F, 51. The key value is formed by concatenating bytes with these character values in reverse order and adding 160. The simplest way to do this is

  KEY = XTD('514F1B') + 160



See also: