mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
Merge branch 'obsd-master'
This commit is contained in:
@ -1862,6 +1862,26 @@ server_client_update_latest(struct client *c)
|
||||
notify_client("client-active", c);
|
||||
}
|
||||
|
||||
/* Get repeat time. */
|
||||
static u_int
|
||||
server_client_repeat_time(struct client *c, struct key_binding *bd)
|
||||
{
|
||||
struct session *s = c->session;
|
||||
u_int repeat, initial;
|
||||
|
||||
if (~bd->flags & KEY_BINDING_REPEAT)
|
||||
return (0);
|
||||
repeat = options_get_number(s->options, "repeat-time");
|
||||
if (repeat == 0)
|
||||
return (0);
|
||||
if ((~c->flags & CLIENT_REPEAT) || bd->key != c->last_key) {
|
||||
initial = options_get_number(s->options, "initial-repeat-time");
|
||||
if (initial != 0)
|
||||
repeat = initial;
|
||||
}
|
||||
return (repeat);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle data key input from client. This owns and can modify the key event it
|
||||
* is given and is responsible for freeing it.
|
||||
@ -1880,7 +1900,7 @@ server_client_key_callback(struct cmdq_item *item, void *data)
|
||||
struct timeval tv;
|
||||
struct key_table *table, *first;
|
||||
struct key_binding *bd;
|
||||
int xtimeout;
|
||||
u_int repeat;
|
||||
uint64_t flags, prefix_delay;
|
||||
struct cmd_find_state fs;
|
||||
key_code key0, prefix, prefix2;
|
||||
@ -2036,12 +2056,13 @@ try_again:
|
||||
* If this is a repeating key, start the timer. Otherwise reset
|
||||
* the client back to the root table.
|
||||
*/
|
||||
xtimeout = options_get_number(s->options, "repeat-time");
|
||||
if (xtimeout != 0 && (bd->flags & KEY_BINDING_REPEAT)) {
|
||||
repeat = server_client_repeat_time(c, bd);
|
||||
if (repeat != 0) {
|
||||
c->flags |= CLIENT_REPEAT;
|
||||
c->last_key = bd->key;
|
||||
|
||||
tv.tv_sec = xtimeout / 1000;
|
||||
tv.tv_usec = (xtimeout % 1000) * 1000L;
|
||||
tv.tv_sec = repeat / 1000;
|
||||
tv.tv_usec = (repeat % 1000) * 1000L;
|
||||
evtimer_del(&c->repeat_timer);
|
||||
evtimer_add(&c->repeat_timer, &tv);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user