From 483cc77c1cbc6898fef143c8100945139c14a92c Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 12 Jan 2023 18:49:11 +0000 Subject: Have tmux recognise pasted texts wrapped in bracket paste sequences, rather than only forwarding them to the program inside. From Andrew Onyshchuk in GitHub issue 3431. --- tty.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'tty.c') diff --git a/tty.c b/tty.c index d31a2cab..c8a2a6ee 100644 --- a/tty.c +++ b/tty.c @@ -341,6 +341,8 @@ tty_start_tty(struct tty *tty) tty_puts(tty, "\033[?1000l\033[?1002l\033[?1003l"); tty_puts(tty, "\033[?1006l\033[?1005l"); } + if (tty_term_has(tty->term, TTYC_ENBP)) + tty_putcode(tty, TTYC_ENBP); evtimer_set(&tty->start_timer, tty_start_timer_callback, tty); evtimer_add(&tty->start_timer, &tv); @@ -417,8 +419,6 @@ tty_stop_tty(struct tty *tty) else if (tty_term_has(tty->term, TTYC_SS)) tty_raw(tty, tty_term_string1(tty->term, TTYC_SS, 0)); } - if (tty->mode & MODE_BRACKETPASTE) - tty_raw(tty, tty_term_string(tty->term, TTYC_DSBP)); if (tty->ccolour != -1) tty_raw(tty, tty_term_string(tty->term, TTYC_CR)); @@ -427,6 +427,8 @@ tty_stop_tty(struct tty *tty) tty_raw(tty, "\033[?1000l\033[?1002l\033[?1003l"); tty_raw(tty, "\033[?1006l\033[?1005l"); } + if (tty_term_has(tty->term, TTYC_DSBP)) + tty_raw(tty, tty_term_string(tty->term, TTYC_DSBP)); if (tty->term->flags & TERM_VT100LIKE) tty_raw(tty, "\033[?7727l"); @@ -825,12 +827,6 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s) else if (mode & MODE_MOUSE_STANDARD) tty_puts(tty, "\033[?1000h"); } - if (changed & MODE_BRACKETPASTE) { - if (mode & MODE_BRACKETPASTE) - tty_putcode(tty, TTYC_ENBP); - else - tty_putcode(tty, TTYC_DSBP); - } tty->mode = mode; } -- cgit