=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server.c,v retrieving revision 1.39 retrieving revision 1.40 diff -c -r1.39 -r1.40 *** src/usr.bin/tmux/server.c 2009/09/20 14:58:12 1.39 --- src/usr.bin/tmux/server.c 2009/09/22 12:38:10 1.40 *************** *** 1,4 **** ! /* $OpenBSD: server.c,v 1.39 2009/09/20 14:58:12 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server.c,v 1.40 2009/09/22 12:38:10 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 798,805 **** struct screen *s; struct timeval tv; struct key_binding *bd; ! int key, prefix, status, xtimeout; ! int mode; u_char mouse[3]; xtimeout = options_get_number(&c->session->options, "repeat-time"); --- 798,806 ---- struct screen *s; struct timeval tv; struct key_binding *bd; ! 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,817 **** } /* Process keys. */ ! prefix = options_get_number(&c->session->options, "prefix"); while (tty_keys_next(&c->tty, &key, mouse) == 0) { server_activity = time(NULL); --- 812,818 ---- } /* Process keys. */ ! keylist = options_get_data(&c->session->options, "prefix"); while (tty_keys_next(&c->tty, &key, mouse) == 0) { server_activity = time(NULL); *************** *** 844,852 **** continue; } /* No previous prefix key. */ if (!(c->flags & CLIENT_PREFIX)) { ! if (key == prefix) c->flags |= CLIENT_PREFIX; else { /* Try as a non-prefix key binding. */ --- 845,862 ---- 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 (isprefix) c->flags |= CLIENT_PREFIX; else { /* Try as a non-prefix key binding. */ *************** *** 864,870 **** /* If repeating, treat this as a key, else ignore. */ if (c->flags & CLIENT_REPEAT) { c->flags &= ~CLIENT_REPEAT; ! if (key == prefix) c->flags |= CLIENT_PREFIX; else window_pane_key(wp, c, key); --- 874,880 ---- /* If repeating, treat this as a key, else ignore. */ if (c->flags & CLIENT_REPEAT) { c->flags &= ~CLIENT_REPEAT; ! if (isprefix) c->flags |= CLIENT_PREFIX; else window_pane_key(wp, c, key); *************** *** 875,881 **** /* 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) c->flags |= CLIENT_PREFIX; else window_pane_key(wp, c, key); --- 885,891 ---- /* If already repeating, but this key can't repeat, skip it. */ if (c->flags & CLIENT_REPEAT && !bd->can_repeat) { c->flags &= ~CLIENT_REPEAT; ! if (isprefix) c->flags |= CLIENT_PREFIX; else window_pane_key(wp, c, key);