version 1.39, 2009/09/20 14:58:12 |
version 1.40, 2009/09/22 12:38:10 |
|
|
struct screen *s; |
struct screen *s; |
struct timeval tv; |
struct timeval tv; |
struct key_binding *bd; |
struct key_binding *bd; |
int key, prefix, status, xtimeout; |
struct keylist *keylist; |
int mode; |
int key, status, xtimeout, mode, isprefix; |
|
u_int i; |
u_char mouse[3]; |
u_char mouse[3]; |
|
|
xtimeout = options_get_number(&c->session->options, "repeat-time"); |
xtimeout = options_get_number(&c->session->options, "repeat-time"); |
|
|
} |
} |
|
|
/* Process keys. */ |
/* 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) { |
while (tty_keys_next(&c->tty, &key, mouse) == 0) { |
server_activity = time(NULL); |
server_activity = time(NULL); |
|
|
|
|
continue; |
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. */ |
/* No previous prefix key. */ |
if (!(c->flags & CLIENT_PREFIX)) { |
if (!(c->flags & CLIENT_PREFIX)) { |
if (key == prefix) |
if (isprefix) |
c->flags |= CLIENT_PREFIX; |
c->flags |= CLIENT_PREFIX; |
else { |
else { |
/* Try as a non-prefix key binding. */ |
/* Try as a non-prefix key binding. */ |
|
|
/* If repeating, treat this as a key, else ignore. */ |
/* If repeating, treat this as a key, else ignore. */ |
if (c->flags & CLIENT_REPEAT) { |
if (c->flags & CLIENT_REPEAT) { |
c->flags &= ~CLIENT_REPEAT; |
c->flags &= ~CLIENT_REPEAT; |
if (key == prefix) |
if (isprefix) |
c->flags |= CLIENT_PREFIX; |
c->flags |= CLIENT_PREFIX; |
else |
else |
window_pane_key(wp, c, key); |
window_pane_key(wp, c, key); |
|
|
/* If already repeating, but this key can't repeat, skip it. */ |
/* If already repeating, but this key can't repeat, skip it. */ |
if (c->flags & CLIENT_REPEAT && !bd->can_repeat) { |
if (c->flags & CLIENT_REPEAT && !bd->can_repeat) { |
c->flags &= ~CLIENT_REPEAT; |
c->flags &= ~CLIENT_REPEAT; |
if (key == prefix) |
if (isprefix) |
c->flags |= CLIENT_PREFIX; |
c->flags |= CLIENT_PREFIX; |
else |
else |
window_pane_key(wp, c, key); |
window_pane_key(wp, c, key); |