tty: Add option to forward unrequested escape sequence

Adds an option "forward-unrequested-escseq" for tmux to forward
unrequested escape sequences to the client. For example, when an OSC 52
escape sequence is received outside a designated TTY_OSC52QUERY context,
it will be passed on to the client application if the option is on,
otherwise it's discarded.
This commit is contained in:
holio0
2024-10-17 10:34:45 +08:00
parent 46f3846659
commit 8ca212579a
3 changed files with 17 additions and 2 deletions

View File

@@ -1339,8 +1339,10 @@ tty_keys_clipboard(struct tty *tty, const char *buf, size_t len, size_t *size)
end--;
/* If we did not request this, ignore it. */
if (~tty->flags & TTY_OSC52QUERY)
return (0);
if (~tty->flags & TTY_OSC52QUERY) {
return options_get_number(global_options,
"forward-unrequested-escseq") ? (-1) : (0);
}
tty->flags &= ~TTY_OSC52QUERY;
evtimer_del(&tty->clipboard_timer);