aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-02 01:55:44 +0200
committerMattias Andrée <maandree@kth.se>2021-04-02 01:55:44 +0200
commita523a2d3669b8799121a9d4260decb20df39b590 (patch)
tree8d83eadb1cd20c94e04122095bdc7fdd2b0565e8
parentAdd TODO (diff)
downloadlibterminput-a523a2d3669b8799121a9d4260decb20df39b590.tar.gz
libterminput-a523a2d3669b8799121a9d4260decb20df39b590.tar.bz2
libterminput-a523a2d3669b8799121a9d4260decb20df39b590.tar.xz
Add more key codes
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--libterminput.c6
-rw-r--r--libterminput.h9
2 files changed, 11 insertions, 4 deletions
diff --git a/libterminput.c b/libterminput.c
index a255373..d721abd 100644
--- a/libterminput.c
+++ b/libterminput.c
@@ -143,13 +143,19 @@ parse_sequence(union libterminput_input *input, struct libterminput_state *ctx)
switch (keylen) {
case 2:
switch (ctx->key[1]) {
+ case '@': input->keypress.key = LIBTERMINPUT_INS; break;
case 'A': input->keypress.key = LIBTERMINPUT_UP; break;
case 'B': input->keypress.key = LIBTERMINPUT_DOWN; break;
case 'C': input->keypress.key = LIBTERMINPUT_RIGHT; break;
case 'D': input->keypress.key = LIBTERMINPUT_LEFT; break;
case 'E': input->keypress.key = LIBTERMINPUT_BEGIN; break;
+ case 'F': input->keypress.key = LIBTERMINPUT_END; break;
case 'G': input->keypress.key = LIBTERMINPUT_BEGIN; break;
+ case 'H': input->keypress.key = LIBTERMINPUT_HOME; break;
+ case 'M': input->keypress.key = LIBTERMINPUT_MACRO; break;
case 'P': input->keypress.key = LIBTERMINPUT_PAUSE; break;
+ case 'U': input->keypress.key = LIBTERMINPUT_NEXT; break;
+ case 'V': input->keypress.key = LIBTERMINPUT_PRIOR; break;
case 'Z':
input->keypress.key = LIBTERMINPUT_TAB;
input->keypress.mods |= LIBTERMINPUT_SHIFT;
diff --git a/libterminput.h b/libterminput.h
index b86a2bd..4e33d09 100644
--- a/libterminput.h
+++ b/libterminput.h
@@ -32,10 +32,10 @@ enum libterminput_key {
LIBTERMINPUT_F10,
LIBTERMINPUT_F11,
LIBTERMINPUT_F12,
- LIBTERMINPUT_HOME,
+ LIBTERMINPUT_HOME, /* = find */
LIBTERMINPUT_INS,
- LIBTERMINPUT_DEL,
- LIBTERMINPUT_END,
+ LIBTERMINPUT_DEL, /* = remove */
+ LIBTERMINPUT_END, /* = select */
LIBTERMINPUT_PRIOR, /* page up */
LIBTERMINPUT_NEXT, /* page down */
LIBTERMINPUT_ERASE, /* backspace */
@@ -54,7 +54,8 @@ enum libterminput_key {
LIBTERMINPUT_KEYPAD_MINUS,
LIBTERMINPUT_KEYPAD_COMMA,
LIBTERMINPUT_KEYPAD_POINT,
- LIBTERMINPUT_KEYPAD_ENTER
+ LIBTERMINPUT_KEYPAD_ENTER,
+ LIBTERMINPUT_MACRO
};
enum libterminput_type {