diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2023-09-02 20:03:11 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2023-09-02 20:03:11 +0000 |
commit | 05a8318f217da7c79ecfc7bccb3e9049e5f87e25 (patch) | |
tree | 6384261b8f54499da14db19e099657366c73cdda /usr.bin/tmux/tty.c | |
parent | d5b2d687bb2623df2abce8d971b8993c3c4730fa (diff) |
Request terminal colours again on SIGWINCH but at most once every 30
seconds, GitHub issue 3582.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r-- | usr.bin/tmux/tty.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 00988286f83..efbc4a3cc4c 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.433 2023/09/02 09:17:23 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.434 2023/09/02 20:03:10 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -82,6 +82,7 @@ static void tty_check_overlay_range(struct tty *, u_int, u_int, u_int, #define TTY_BLOCK_STOP(tty) (1 + ((tty)->sx * (tty)->sy) / 8) #define TTY_QUERY_TIMEOUT 5 +#define TTY_REQUEST_LIMIT 30 void tty_create_log(void) @@ -369,12 +370,29 @@ tty_send_requests(struct tty *tty) tty_puts(tty, "\033[>c"); if (~tty->flags & TTY_HAVEXDA) tty_puts(tty, "\033[>q"); - if (~tty->flags & TTY_HAVEFG) - tty_puts(tty, "\033]10;?\033\\"); - if (~tty->flags & TTY_HAVEBG) - tty_puts(tty, "\033]11;?\033\\"); + tty_puts(tty, "\033]10;?\033\\"); + tty_puts(tty, "\033]11;?\033\\"); } else tty->flags |= TTY_ALL_REQUEST_FLAGS; + tty->last_requests = time (NULL); +} + +void +tty_repeat_requests(struct tty *tty) +{ + time_t t = time (NULL); + + if (~tty->flags & TTY_STARTED) + return; + + if (t - tty->last_requests <= TTY_REQUEST_LIMIT) + return; + tty->last_requests = t; + + if (tty->term->flags & TERM_VT100LIKE) { + tty_puts(tty, "\033]10;?\033\\"); + tty_puts(tty, "\033]11;?\033\\"); + } } void |