mirror of
https://github.com/tmux/tmux.git
synced 2025-09-05 19:08:16 +00:00
Increase the escape delay when waiting for an RGB response no matter
when it is triggered (they can also be sent on resize). GitHub issue 4569.
This commit is contained in:
@@ -3358,7 +3358,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
|
||||
break;
|
||||
server_client_update_latest(c);
|
||||
tty_resize(&c->tty);
|
||||
tty_repeat_requests(&c->tty);
|
||||
tty_repeat_requests(&c->tty, 0);
|
||||
recalculate_sizes();
|
||||
if (c->overlay_resize == NULL)
|
||||
server_client_clear_overlay(c);
|
||||
@@ -3958,5 +3958,5 @@ server_client_report_theme(struct client *c, enum client_theme theme)
|
||||
* Request foreground and background colour again. Don't forward 2031 to
|
||||
* panes until a response is received.
|
||||
*/
|
||||
tty_puts(&c->tty, "\033]10;?\033\\\033]11;?\033\\");
|
||||
tty_repeat_requests(&c->tty, 1);
|
||||
}
|
||||
|
@@ -937,7 +937,8 @@ partial_key:
|
||||
delay = options_get_number(global_options, "escape-time");
|
||||
if (delay == 0)
|
||||
delay = 1;
|
||||
if ((tty->flags & TTY_ALL_REQUEST_FLAGS) != TTY_ALL_REQUEST_FLAGS) {
|
||||
if ((tty->flags & (TTY_WAITFG|TTY_WAITBG) ||
|
||||
(tty->flags & TTY_ALL_REQUEST_FLAGS) != TTY_ALL_REQUEST_FLAGS)) {
|
||||
log_debug("%s: increasing delay for active query", c->name);
|
||||
if (delay < 500)
|
||||
delay = 500;
|
||||
@@ -1686,14 +1687,14 @@ tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size,
|
||||
else
|
||||
log_debug("fg is %s", colour_tostring(n));
|
||||
*fg = n;
|
||||
tty->flags |= TTY_HAVEFG;
|
||||
tty->flags &= ~TTY_WAITFG;
|
||||
} else if (n != -1) {
|
||||
if (c != NULL)
|
||||
log_debug("%s bg is %s", c->name, colour_tostring(n));
|
||||
else
|
||||
log_debug("bg is %s", colour_tostring(n));
|
||||
*bg = n;
|
||||
tty->flags |= TTY_HAVEBG;
|
||||
tty->flags &= ~TTY_WAITBG;
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
36
tty.c
36
tty.c
@@ -306,9 +306,23 @@ tty_start_timer_callback(__unused int fd, __unused short events, void *data)
|
||||
struct client *c = tty->client;
|
||||
|
||||
log_debug("%s: start timer fired", c->name);
|
||||
|
||||
if ((tty->flags & (TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA)) == 0)
|
||||
tty_update_features(tty);
|
||||
tty->flags |= TTY_ALL_REQUEST_FLAGS;
|
||||
|
||||
tty->flags &= ~(TTY_WAITBG|TTY_WAITFG);
|
||||
}
|
||||
|
||||
static void
|
||||
tty_start_start_timer(struct tty *tty)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
struct timeval tv = { .tv_sec = TTY_QUERY_TIMEOUT };
|
||||
|
||||
log_debug("%s: start timer started", c->name);
|
||||
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
|
||||
evtimer_add(&tty->start_timer, &tv);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -316,7 +330,6 @@ tty_start_tty(struct tty *tty)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
struct termios tio;
|
||||
struct timeval tv = { .tv_sec = TTY_QUERY_TIMEOUT };
|
||||
|
||||
setblocking(c->fd, 0);
|
||||
event_add(&tty->event_in, NULL);
|
||||
@@ -356,8 +369,7 @@ tty_start_tty(struct tty *tty)
|
||||
tty_puts(tty, "\033[?2031h\033[?996n");
|
||||
}
|
||||
|
||||
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
|
||||
evtimer_add(&tty->start_timer, &tv);
|
||||
tty_start_start_timer(tty);
|
||||
|
||||
tty->flags |= TTY_STARTED;
|
||||
tty_invalidate(tty);
|
||||
@@ -383,29 +395,35 @@ tty_send_requests(struct tty *tty)
|
||||
tty_puts(tty, "\033[>c");
|
||||
if (~tty->flags & TTY_HAVEXDA)
|
||||
tty_puts(tty, "\033[>q");
|
||||
tty_puts(tty, "\033]10;?\033\\");
|
||||
tty_puts(tty, "\033]11;?\033\\");
|
||||
tty_puts(tty, "\033]10;?\033\\\033]11;?\033\\");
|
||||
tty->flags |= (TTY_WAITBG|TTY_WAITFG);
|
||||
} else
|
||||
tty->flags |= TTY_ALL_REQUEST_FLAGS;
|
||||
tty->last_requests = time(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
tty_repeat_requests(struct tty *tty)
|
||||
tty_repeat_requests(struct tty *tty, int force)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
time_t t = time(NULL);
|
||||
u_int n = t - tty->last_requests;
|
||||
|
||||
if (~tty->flags & TTY_STARTED)
|
||||
return;
|
||||
|
||||
if (t - tty->last_requests <= TTY_REQUEST_LIMIT)
|
||||
if (!force && n <= TTY_REQUEST_LIMIT) {
|
||||
log_debug("%s: not repeating requests (%u seconds)", c->name, n);
|
||||
return;
|
||||
}
|
||||
log_debug("%s: %srepeating requests (%u seconds)", c->name, force ? "(force) " : "" , n);
|
||||
tty->last_requests = t;
|
||||
|
||||
if (tty->term->flags & TERM_VT100LIKE) {
|
||||
tty_puts(tty, "\033]10;?\033\\");
|
||||
tty_puts(tty, "\033]11;?\033\\");
|
||||
tty_puts(tty, "\033]10;?\033\\\033]11;?\033\\");
|
||||
tty->flags |= (TTY_WAITBG|TTY_WAITFG);
|
||||
}
|
||||
tty_start_start_timer(tty);
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user