diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-09-22 12:38:10 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-09-22 12:38:10 +0000 |
commit | 96dd3e8eb9bbe5393050acfd4ac7759ae27d00c8 (patch) | |
tree | e637c693907a716deeef38264004b9bcc6d24971 /server.c | |
parent | 6fab9a3e6f0a18ce63662fceedb87e96f2680d83 (diff) | |
download | rtmux-96dd3e8eb9bbe5393050acfd4ac7759ae27d00c8.tar.gz rtmux-96dd3e8eb9bbe5393050acfd4ac7759ae27d00c8.tar.bz2 rtmux-96dd3e8eb9bbe5393050acfd4ac7759ae27d00c8.zip |
Permit multiple prefix keys to be defined, separated by commas, for example:
set -g prefix ^a,^b
Any key in the list acts as the prefix. The send-prefix command always sends
the first key in the list.
Diffstat (limited to 'server.c')
-rw-r--r-- | server.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -798,8 +798,9 @@ server_handle_client(struct client *c) struct screen *s; struct timeval tv; struct key_binding *bd; - int key, prefix, status, xtimeout; - int mode; + struct keylist *keylist; + int key, status, xtimeout, mode, isprefix; + u_int i; u_char mouse[3]; xtimeout = options_get_number(&c->session->options, "repeat-time"); @@ -811,7 +812,7 @@ server_handle_client(struct client *c) } /* Process keys. */ - prefix = options_get_number(&c->session->options, "prefix"); + keylist = options_get_data(&c->session->options, "prefix"); while (tty_keys_next(&c->tty, &key, mouse) == 0) { server_activity = time(NULL); @@ -844,9 +845,18 @@ server_handle_client(struct client *c) continue; } + /* Is this a prefix key? */ + isprefix = 0; + for (i = 0; i < ARRAY_LENGTH(keylist); i++) { + if (key == ARRAY_ITEM(keylist, i)) { + isprefix = 1; + break; + } + } + /* No previous prefix key. */ if (!(c->flags & CLIENT_PREFIX)) { - if (key == prefix) + if (isprefix) c->flags |= CLIENT_PREFIX; else { /* Try as a non-prefix key binding. */ @@ -864,7 +874,7 @@ server_handle_client(struct client *c) /* If repeating, treat this as a key, else ignore. */ if (c->flags & CLIENT_REPEAT) { c->flags &= ~CLIENT_REPEAT; - if (key == prefix) + if (isprefix) c->flags |= CLIENT_PREFIX; else window_pane_key(wp, c, key); @@ -875,7 +885,7 @@ server_handle_client(struct client *c) /* If already repeating, but this key can't repeat, skip it. */ if (c->flags & CLIENT_REPEAT && !bd->can_repeat) { c->flags &= ~CLIENT_REPEAT; - if (key == prefix) + if (isprefix) c->flags |= CLIENT_PREFIX; else window_pane_key(wp, c, key); |