about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-09-11 09:05:22 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-09-11 09:05:22 -0700
commit5cee556294afda23b0cce20afa365798f5ffbccc (patch)
tree52c49d5564bcc48d778f93fecce2644c469f62c0
parent8beff53e5a65ac23411221fdcf6e9607b6c2a715 (diff)
downloadmu-5cee556294afda23b0cce20afa365798f5ffbccc.tar.gz
2181 - detect shift-tab
Does nothing useful yet, though.
-rw-r--r--termbox/input.inl6
-rw-r--r--termbox/termbox.h9
2 files changed, 10 insertions, 5 deletions
diff --git a/termbox/input.inl b/termbox/input.inl
index 97e1f4b7..83b4bb8c 100644
--- a/termbox/input.inl
+++ b/termbox/input.inl
@@ -112,6 +112,12 @@ static int parse_escape_seq(struct tb_event *event, const char *buf, int len)
     parse_attempts = 0;
     return strlen("\033[1;5D");
   }
+  if (starts_with(buf, len, "\033[Z")) {
+    event->ch = 0;
+    event->key = TB_KEY_SHIFT_TAB;
+    parse_attempts = 0;
+    return strlen("\033[Z");
+  }
 
   // no escape sequence recognized? wait a bit in case our buffer is incomplete
   ++parse_attempts;
diff --git a/termbox/termbox.h b/termbox/termbox.h
index d52f2565..e5434196 100644
--- a/termbox/termbox.h
+++ b/termbox/termbox.h
@@ -97,11 +97,7 @@ struct tb_event {
 #define TB_EVENT_RESIZE 2
 #define TB_EVENT_MOUSE  3
 
-/* Possible values for tb_event.key.
- *
- * These are a safe subset of terminfo keys, which exist on all popular
- * terminals. Termbox uses only them to stay truly portable.
- */
+/* Possible values for tb_event.key. */
 #define TB_KEY_F1               (0xFFFF-0)
 #define TB_KEY_F2               (0xFFFF-1)
 #define TB_KEY_F3               (0xFFFF-2)
@@ -136,6 +132,9 @@ struct tb_event {
 #define TB_KEY_CTRL_ARROW_DOWN  (0xFFFF-31)
 #define TB_KEY_CTRL_ARROW_LEFT  (0xFFFF-32)
 #define TB_KEY_CTRL_ARROW_RIGHT (0xFFFF-33)
+#define TB_KEY_SHIFT_TAB (0xFFFF-34)
+
+/* Names for some of the possible values for tb_event.ch. */
 /* These are all ASCII code points below SPACE character and a BACKSPACE key. */
 #define TB_KEY_CTRL_TILDE       0x00
 #define TB_KEY_CTRL_2           0x00 /* clash with 'CTRL_TILDE' */