From 5cee556294afda23b0cce20afa365798f5ffbccc Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 11 Sep 2015 09:05:22 -0700 Subject: 2181 - detect shift-tab Does nothing useful yet, though. --- termbox/input.inl | 6 ++++++ termbox/termbox.h | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'termbox') 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' */ -- cgit 1.4.1-2-gfad0