From 80e0158112b73029d27452bc08b18079df3f898c Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 5 Nov 2009 19:29:41 +0000 Subject: Switch the tty key tree over to an (unbalanced) ternary tree which allows partial matches to be done (they wait for further data or a timer to expire, like a naked escape). Mouse and xterm-style keys still expect to be atomic. --- tmux.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'tmux.h') diff --git a/tmux.h b/tmux.h index c2165287..14890440 100644 --- a/tmux.h +++ b/tmux.h @@ -936,10 +936,13 @@ ARRAY_DECL(sessions, struct session *); /* TTY information. */ struct tty_key { + char ch; int key; - char *string; - RB_ENTRY(tty_key) entry; + struct tty_key *left; + struct tty_key *right; + + struct tty_key *next; }; struct tty_term { @@ -998,9 +1001,7 @@ struct tty { void (*key_callback)(int, struct mouse_event *, void *); void *key_data; struct event key_timer; - - size_t ksize; /* maximum key size */ - RB_HEAD(tty_keys, tty_key) ktree; + struct tty_key *key_tree; }; /* TTY command context and function pointer. */ @@ -1351,8 +1352,6 @@ int tty_term_number(struct tty_term *, enum tty_code_code); int tty_term_flag(struct tty_term *, enum tty_code_code); /* tty-keys.c */ -int tty_keys_cmp(struct tty_key *, struct tty_key *); -RB_PROTOTYPE(tty_keys, tty_key, entry, tty_keys_cmp); void tty_keys_init(struct tty *); void tty_keys_free(struct tty *); int tty_keys_next(struct tty *); -- cgit