-/* $OpenBSD: input-keys.c,v 1.93 2022/11/08 10:04:31 nicm Exp $ */
+/* $OpenBSD: input-keys.c,v 1.94 2023/01/12 18:49:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
ike = input_key_get(key & ~KEYC_EXTENDED);
if (ike != NULL) {
log_debug("found key 0x%llx: \"%s\"", key, ike->data);
+ if ((key == KEYC_PASTE_START || key == KEYC_PASTE_END) &&
+ (~s->mode & MODE_BRACKETPASTE))
+ return (0);
if ((key & KEYC_META) && (~key & KEYC_IMPLIED_META))
input_key_write(__func__, bev, "\033", 1);
input_key_write(__func__, bev, ike->data, strlen(ike->data));
-/* $OpenBSD: server-client.c,v 1.397 2022/07/19 07:10:13 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.398 2023/01/12 18:49:11 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
static void server_client_set_title(struct client *);
static void server_client_set_path(struct client *);
static void server_client_reset_state(struct client *);
+static int server_client_is_bracket_pasting(struct client *, key_code);
static int server_client_assume_paste(struct session *);
static void server_client_update_latest(struct client *);
return (key);
}
+/* Is this a bracket paste key? */
+static int
+server_client_is_bracket_pasting(struct client *c, key_code key)
+{
+ if (key == KEYC_PASTE_START) {
+ c->flags |= CLIENT_BRACKETPASTING;
+ log_debug("%s: bracket paste on", c->name);
+ return (1);
+ }
+
+ if (key == KEYC_PASTE_END) {
+ c->flags &= ~CLIENT_BRACKETPASTING;
+ log_debug("%s: bracket paste off", c->name);
+ return (1);
+ }
+
+ return !!(c->flags & CLIENT_BRACKETPASTING);
+}
+
/* Is this fast enough to probably be a paste? */
static int
server_client_assume_paste(struct session *s)
if (KEYC_IS_MOUSE(key) && !options_get_number(s->options, "mouse"))
goto forward_key;
+ /* Forward if bracket pasting. */
+ if (server_client_is_bracket_pasting(c, key))
+ goto forward_key;
+
/* Treat everything as a regular key when pasting is detected. */
if (!KEYC_IS_MOUSE(key) && server_client_assume_paste(s))
goto forward_key;
-/* $OpenBSD: tmux.h,v 1.1190 2023/01/06 07:09:27 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1191 2023/01/12 18:49:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
#define CLIENT_CONTROL_WAITEXIT 0x200000000ULL
#define CLIENT_WINDOWSIZECHANGED 0x400000000ULL
#define CLIENT_CLIPBOARDBUFFER 0x800000000ULL
+#define CLIENT_BRACKETPASTING 0x1000000000ULL
#define CLIENT_ALLREDRAWFLAGS \
(CLIENT_REDRAWWINDOW| \
CLIENT_REDRAWSTATUS| \
-/* $OpenBSD: tty.c,v 1.426 2023/01/03 11:43:24 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.427 2023/01/12 18:49:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
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);
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));
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");
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;
}