aboutsummaryrefslogtreecommitdiff
path: root/driver-csi.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-11-30 14:35:23 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-11-30 14:35:23 +0000
commit7b3dc4be71e9c611bc4a6b191264f99eb642d44c (patch)
tree19aea2fd55a00f6d0fbaf252e327bc2b6850eea5 /driver-csi.c
parentd241d6216abcf3607a72e53b18f2d0b5882bb164 (diff)
downloadtermo-7b3dc4be71e9c611bc4a6b191264f99eb642d44c.tar.gz
termo-7b3dc4be71e9c611bc4a6b191264f99eb642d44c.tar.xz
termo-7b3dc4be71e9c611bc4a6b191264f99eb642d44c.zip
Return a real key type for unrecognised CSI sequences; allow accessing them by termkey_interpret_csi()
Diffstat (limited to 'driver-csi.c')
-rw-r--r--driver-csi.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/driver-csi.c b/driver-csi.c
index 80f7eaa..bb699bd 100644
--- a/driver-csi.c
+++ b/driver-csi.c
@@ -419,7 +419,7 @@ static TermKeyResult peekkey_csi(TermKey *tk, TermKeyCsi *csi, size_t introlen,
if(csi_handlers[(cmd & 0xff) - 0x40])
result = (*csi_handlers[(cmd & 0xff) - 0x40])(tk, key, cmd, arg, args);
- if(key->code.sym == TERMKEY_SYM_UNKNOWN) {
+ if(result == TERMKEY_RES_NONE) {
#ifdef DEBUG
switch(args) {
case 1:
@@ -436,7 +436,12 @@ static TermKeyResult peekkey_csi(TermKey *tk, TermKeyCsi *csi, size_t introlen,
break;
}
#endif
- return TERMKEY_RES_NONE;
+ key->type = TERMKEY_TYPE_UNKNOWN_CSI;
+ key->code.number = cmd;
+
+ tk->hightide = csi_len - introlen;
+ *nbytep = introlen; // Do not yet eat the data bytes
+ return TERMKEY_RES_KEY;
}
*nbytep = csi_len;
@@ -518,6 +523,19 @@ static TermKeyResult peekkey(TermKey *tk, void *info, TermKeyKey *key, int force
return TERMKEY_RES_NONE;
}
+/* non-static */
+TermKeyResult termkey_interpret_csi(TermKey *tk, const TermKeyKey *key, long args[], size_t *nargs, unsigned long *cmd)
+{
+ size_t dummy;
+
+ if(tk->hightide == 0)
+ return TERMKEY_RES_NONE;
+ if(key->type != TERMKEY_TYPE_UNKNOWN_CSI)
+ return TERMKEY_RES_NONE;
+
+ return parse_csi(tk, 0, &dummy, args, nargs, cmd);
+}
+
struct TermKeyDriver termkey_driver_csi = {
.name = "CSI",