aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/handlekeys.h
diff options
context:
space:
mode:
Diffstat (limited to 'handlekeys.h')
-rw-r--r--handlekeys.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/handlekeys.h b/handlekeys.h
index 192d96c..9678131 100644
--- a/handlekeys.h
+++ b/handlekeys.h
@@ -5,7 +5,7 @@
5 5
6/* An input loop that handles keystrokes and terminal CSI commands. 6/* An input loop that handles keystrokes and terminal CSI commands.
7 * 7 *
8 * Reads stdin, trying to convert raw keystrokes into something more readable. 8 * Reads stdin, trying to translate raw keystrokes into something more readable.
9 * See the keys[] array at the top of handlekeys.c for what byte sequences get 9 * See the keys[] array at the top of handlekeys.c for what byte sequences get
10 * translated into what key names. See dumbsh.c for an example of usage. 10 * translated into what key names. See dumbsh.c for an example of usage.
11 * A 0.1 second delay is used to detect the Esc key being pressed, and not Esc 11 * A 0.1 second delay is used to detect the Esc key being pressed, and not Esc
@@ -27,9 +27,15 @@
27 * handle_CSI - a callback to handle terminal CSI commands. 27 * handle_CSI - a callback to handle terminal CSI commands.
28 * 28 *
29 * handle_sequence is called when a complete keystroke sequence has been 29 * handle_sequence is called when a complete keystroke sequence has been
30 * accumulated. It should return 1 if the sequence has been dealt with, 30 * accumulated. The sequence argument holds the accumulated keystrokes.
31 * otherwise it should return 0, then handle_keys will keep adding more 31 * The translated argument flags if any have been translated, otherwise you
32 * complete keystroke sequences on the end, and try again later. 32 * can assume it's all ordinary characters.
33 *
34 * handle_keys should return 1 if the sequence has been dealt with, or ignored.
35 * It should return 0, if handle_keys should keep adding more
36 * translated keystroke sequences on the end, and try again later.
37 * 0 should really only be used if it's a partial match, and we need more
38 * keys in the sequence to make a full match.
33 * 39 *
34 * handle_CSI is called when a complete terminal CSI command has been 40 * handle_CSI is called when a complete terminal CSI command has been
35 * detected. The command argument is the full CSI command code, including 41 * detected. The command argument is the full CSI command code, including
@@ -45,7 +51,7 @@
45 * get accumulated until fully recognised by the user code. 51 * get accumulated until fully recognised by the user code.
46 */ 52 */
47void handle_keys(long extra, 53void handle_keys(long extra,
48 int (*handle_sequence)(long extra, char *sequence), 54 int (*handle_sequence)(long extra, char *sequence, int isTranslated),
49 void (*handle_CSI)(long extra, char *command, int *params, int count)); 55 void (*handle_CSI)(long extra, char *command, int *params, int count));
50 56
51 57