sync with OpenBSD -current

This commit is contained in:
purplerain 2024-10-03 15:29:20 +00:00
parent 00180dc79b
commit 074e641852
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
75 changed files with 2693 additions and 2103 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cmd-send-keys.c,v 1.75 2023/01/16 11:26:14 nicm Exp $ */
/* $OpenBSD: cmd-send-keys.c,v 1.76 2024/10/01 06:15:47 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -73,11 +73,13 @@ cmd_send_keys_inject_key(struct cmdq_item *item, struct cmdq_item *after,
if (args_has(args, 'K')) {
if (tc == NULL)
return (item);
event = xmalloc(sizeof *event);
event = xcalloc(1, sizeof *event);
event->key = key|KEYC_SENT;
memset(&event->m, 0, sizeof event->m);
if (server_client_handle_key(tc, event) == 0)
if (server_client_handle_key(tc, event) == 0) {
free(event->buf);
free(event);
}
return (item);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: input-keys.c,v 1.98 2024/08/26 07:45:05 nicm Exp $ */
/* $OpenBSD: input-keys.c,v 1.101 2024/10/03 05:41:59 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -499,9 +499,12 @@ input_key_vt10x(struct bufferevent *bev, key_code key)
return (0);
}
/* Prevent TAB and RET from being swallowed by C0 remapping logic. */
/*
* Prevent TAB, CR and LF from being swallowed by the C0 remapping
* logic.
*/
onlykey = key & KEYC_MASK_KEY;
if (onlykey == '\r' || onlykey == '\t')
if (onlykey == '\r' || onlykey == '\n' || onlykey == '\t')
key &= ~KEYC_CTRL;
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: mode-tree.c,v 1.69 2024/08/21 04:17:09 nicm Exp $ */
/* $OpenBSD: mode-tree.c,v 1.70 2024/10/01 10:10:29 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -30,6 +30,12 @@ enum mode_tree_search_dir {
MODE_TREE_SEARCH_BACKWARD
};
enum mode_tree_preview {
MODE_TREE_PREVIEW_OFF,
MODE_TREE_PREVIEW_NORMAL,
MODE_TREE_PREVIEW_BIG
};
struct mode_tree_item;
TAILQ_HEAD(mode_tree_list, mode_tree_item);
@ -414,7 +420,12 @@ mode_tree_start(struct window_pane *wp, struct args *args,
mtd->sort_list = sort_list;
mtd->sort_size = sort_size;
mtd->preview = !args_has(args, 'N');
if (args_has(args, 'N') > 1)
mtd->preview = MODE_TREE_PREVIEW_BIG;
else if (args_has(args, 'N'))
mtd->preview = MODE_TREE_PREVIEW_OFF;
else
mtd->preview = MODE_TREE_PREVIEW_NORMAL;
sort = args_get(args, 'O');
if (sort != NULL) {
@ -470,12 +481,21 @@ mode_tree_set_height(struct mode_tree_data *mtd)
if (height < screen_size_y(s))
mtd->height = screen_size_y(s) - height;
} else {
mtd->height = (screen_size_y(s) / 3) * 2;
if (mtd->height > mtd->line_size)
mtd->height = screen_size_y(s) / 2;
if (mtd->preview == MODE_TREE_PREVIEW_NORMAL) {
mtd->height = (screen_size_y(s) / 3) * 2;
if (mtd->height > mtd->line_size)
mtd->height = screen_size_y(s) / 2;
if (mtd->height < 10)
mtd->height = screen_size_y(s);
} else if (mtd->preview == MODE_TREE_PREVIEW_BIG) {
mtd->height = screen_size_y(s) / 4;
if (mtd->height > mtd->line_size)
mtd->height = mtd->line_size;
if (mtd->height < 2)
mtd->height = 2;
} else
mtd->height = screen_size_y(s);
}
if (mtd->height < 10)
mtd->height = screen_size_y(s);
if (screen_size_y(s) - mtd->height < 2)
mtd->height = screen_size_y(s);
}
@ -510,7 +530,7 @@ mode_tree_build(struct mode_tree_data *mtd)
mode_tree_set_current(mtd, tag);
mtd->width = screen_size_x(s);
if (mtd->preview)
if (mtd->preview != MODE_TREE_PREVIEW_OFF)
mode_tree_set_height(mtd);
else
mtd->height = screen_size_y(s);
@ -742,8 +762,11 @@ mode_tree_draw(struct mode_tree_data *mtd)
}
}
if (mtd->preview == MODE_TREE_PREVIEW_OFF)
goto done;
sy = screen_size_y(s);
if (!mtd->preview || sy <= 4 || h <= 4 || sy - h <= 4 || w <= 4)
if (sy <= 4 || h < 2 || sy - h <= 4 || w <= 4)
goto done;
line = &mtd->line_list[mtd->current];
@ -1041,7 +1064,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
if (x > mtd->width || y > mtd->height) {
if (*key == KEYC_MOUSEDOWN3_PANE)
mode_tree_display_menu(mtd, c, x, y, 1);
if (!mtd->preview)
if (mtd->preview == MODE_TREE_PREVIEW_OFF)
*key = KEYC_NONE;
return (0);
}
@ -1232,9 +1255,19 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
PROMPT_NOFORMAT, PROMPT_TYPE_SEARCH);
break;
case 'v':
mtd->preview = !mtd->preview;
switch (mtd->preview) {
case MODE_TREE_PREVIEW_OFF:
mtd->preview = MODE_TREE_PREVIEW_BIG;
break;
case MODE_TREE_PREVIEW_NORMAL:
mtd->preview = MODE_TREE_PREVIEW_OFF;
break;
case MODE_TREE_PREVIEW_BIG:
mtd->preview = MODE_TREE_PREVIEW_NORMAL;
break;
}
mode_tree_build(mtd);
if (mtd->preview)
if (mtd->preview != MODE_TREE_PREVIEW_OFF)
mode_tree_check_selected(mtd);
break;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: options-table.c,v 1.178 2024/09/16 20:28:22 nicm Exp $ */
/* $OpenBSD: options-table.c,v 1.179 2024/10/02 11:51:15 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -824,7 +824,7 @@ const struct options_table_entry options_table[] = {
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SESSION,
.flags = OPTIONS_TABLE_IS_ARRAY,
.default_str = "DISPLAY KRB5CCNAME SSH_ASKPASS SSH_AUTH_SOCK "
.default_str = "DISPLAY KRB5CCNAME MSYSTEM SSH_ASKPASS SSH_AUTH_SOCK "
"SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY",
.text = "List of environment variables to update in the session "
"environment when a client is attached."

View file

@ -1,4 +1,4 @@
/* $OpenBSD: screen.c,v 1.86 2024/08/21 04:17:09 nicm Exp $ */
/* $OpenBSD: screen.c,v 1.87 2024/10/01 08:01:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -170,6 +170,20 @@ screen_reset_tabs(struct screen *s)
bit_set(s->tabs, i);
}
/* Set default cursor style and colour from options. */
void
screen_set_default_cursor(struct screen *s, struct options *oo)
{
int c;
c = options_get_number(oo, "cursor-colour");
s->default_ccolour = c;
c = options_get_number(oo, "cursor-style");
s->default_mode = 0;
screen_set_cursor_style(c, &s->default_cstyle, &s->default_mode);
}
/* Set screen cursor style and mode. */
void
screen_set_cursor_style(u_int style, enum screen_cursor_style *cstyle,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: server-client.c,v 1.409 2024/09/16 20:28:22 nicm Exp $ */
/* $OpenBSD: server-client.c,v 1.410 2024/10/01 06:15:47 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -46,8 +46,6 @@ static void server_client_check_modes(struct client *);
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 *);
static void server_client_dispatch(struct imsg *, void *);
@ -1801,18 +1799,18 @@ out:
/* Is this a bracket paste key? */
static int
server_client_is_bracket_pasting(struct client *c, key_code key)
server_client_is_bracket_paste(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);
return (0);
}
if (key == KEYC_PASTE_END) {
c->flags &= ~CLIENT_BRACKETPASTING;
c->flags &= ~CLIENT_BRACKETPASTING;
log_debug("%s: bracket paste off", c->name);
return (1);
return (0);
}
return !!(c->flags & CLIENT_BRACKETPASTING);
@ -1820,25 +1818,29 @@ server_client_is_bracket_pasting(struct client *c, key_code key)
/* Is this fast enough to probably be a paste? */
static int
server_client_assume_paste(struct session *s)
server_client_is_assume_paste(struct client *c)
{
struct timeval tv;
int t;
struct session *s = c->session;
struct timeval tv;
int t;
if (c->flags & CLIENT_BRACKETPASTING)
return (0);
if ((t = options_get_number(s->options, "assume-paste-time")) == 0)
return (0);
timersub(&s->activity_time, &s->last_activity_time, &tv);
timersub(&c->activity_time, &c->last_activity_time, &tv);
if (tv.tv_sec == 0 && tv.tv_usec < t * 1000) {
log_debug("session %s pasting (flag %d)", s->name,
!!(s->flags & SESSION_PASTING));
if (s->flags & SESSION_PASTING)
if (c->flags & CLIENT_ASSUMEPASTING)
return (1);
s->flags |= SESSION_PASTING;
c->flags |= CLIENT_ASSUMEPASTING;
log_debug("%s: assume paste on", c->name);
return (0);
}
log_debug("session %s not pasting", s->name);
s->flags &= ~SESSION_PASTING;
if (c->flags & CLIENT_ASSUMEPASTING) {
c->flags &= ~CLIENT_ASSUMEPASTING;
log_debug("%s: assume paste off", c->name);
}
return (0);
}
@ -1891,6 +1893,8 @@ server_client_key_callback(struct cmdq_item *item, void *data)
wl = s->curw;
/* Update the activity timer. */
memcpy(&c->last_activity_time, &c->activity_time,
sizeof c->last_activity_time);
if (gettimeofday(&c->activity_time, NULL) != 0)
fatal("gettimeofday failed");
session_update_activity(s, &c->activity_time);
@ -1928,14 +1932,16 @@ server_client_key_callback(struct cmdq_item *item, void *data)
goto forward_key;
/* Forward if bracket pasting. */
if (server_client_is_bracket_pasting(c, key))
goto forward_key;
if (server_client_is_bracket_paste (c, key))
goto paste_key;
/* Treat everything as a regular key when pasting is detected. */
if (!KEYC_IS_MOUSE(key) &&
key != KEYC_FOCUS_IN &&
key != KEYC_FOCUS_OUT &&
(~key & KEYC_SENT) &&
server_client_assume_paste(s))
goto forward_key;
server_client_is_assume_paste(c))
goto paste_key;
/*
* Work out the current key table. If the pane is in a mode, use
@ -2104,10 +2110,20 @@ forward_key:
goto out;
if (wp != NULL)
window_pane_key(wp, c, s, wl, key, m);
goto out;
paste_key:
if (c->flags & CLIENT_READONLY)
goto out;
if (event->buf != NULL)
window_pane_paste(wp, event->buf, event->len);
key = KEYC_NONE;
goto out;
out:
if (s != NULL && key != KEYC_FOCUS_OUT)
server_client_update_latest(c);
free(event->buf);
free(event);
return (CMD_RETURN_NORMAL);
}
@ -2521,11 +2537,13 @@ server_client_click_timer(__unused int fd, __unused short events, void *data)
* Waiting for a third click that hasn't happened, so this must
* have been a double click.
*/
event = xmalloc(sizeof *event);
event = xcalloc(1, sizeof *event);
event->key = KEYC_DOUBLECLICK;
memcpy(&event->m, &c->click_event, sizeof event->m);
if (!server_client_handle_key(c, event))
if (!server_client_handle_key(c, event)) {
free(event->buf);
free(event);
}
}
c->flags &= ~(CLIENT_DOUBLECLICK|CLIENT_TRIPLECLICK);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: session.c,v 1.96 2023/09/02 08:38:37 nicm Exp $ */
/* $OpenBSD: session.c,v 1.97 2024/10/01 06:15:47 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -272,19 +272,16 @@ session_lock_timer(__unused int fd, __unused short events, void *arg)
void
session_update_activity(struct session *s, struct timeval *from)
{
struct timeval *last = &s->last_activity_time;
struct timeval tv;
memcpy(last, &s->activity_time, sizeof *last);
if (from == NULL)
gettimeofday(&s->activity_time, NULL);
else
memcpy(&s->activity_time, from, sizeof s->activity_time);
log_debug("session $%u %s activity %lld.%06d (last %lld.%06d)", s->id,
log_debug("session $%u %s activity %lld.%06d", s->id,
s->name, (long long)s->activity_time.tv_sec,
(int)s->activity_time.tv_usec, (long long)last->tv_sec,
(int)last->tv_usec);
(int)s->activity_time.tv_usec);
if (evtimer_initialized(&s->lock_timer))
evtimer_del(&s->lock_timer);

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.957 2024/09/16 20:46:58 nicm Exp $
.\" $OpenBSD: tmux.1,v 1.958 2024/10/01 10:10:29 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: September 16 2024 $
.Dd $Mdocdate: October 1 2024 $
.Dt TMUX 1
.Os
.Sh NAME
@ -2627,7 +2627,7 @@ specifies the format for each item in the list and
.Fl K
a format for each shortcut key; both are evaluated once for each line.
.Fl N
starts without the preview.
starts without the preview or if given twice with the larger preview.
This command works only if at least one client is attached.
.It Xo
.Ic choose-tree
@ -2711,7 +2711,7 @@ specifies the format for each item in the tree and
.Fl K
a format for each shortcut key; both are evaluated once for each line.
.Fl N
starts without the preview.
starts without the preview or if given twice with the larger preview.
.Fl G
includes all sessions in any session groups in the tree rather than only the
first.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tmux.c,v 1.213 2024/09/29 20:05:42 nicm Exp $ */
/* $OpenBSD: tmux.c,v 1.214 2024/10/02 11:48:16 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -226,7 +226,7 @@ make_label(const char *label, char **cause)
xasprintf(cause, "%s is not a directory", base);
goto fail;
}
if (sb.st_uid != uid || (sb.st_mode & S_IRWXO) != 0) {
if (sb.st_uid != uid || (sb.st_mode & TMUX_SOCK_PERM) != 0) {
xasprintf(cause, "directory %s has unsafe permissions", base);
goto fail;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1229 2024/09/30 08:10:20 nicm Exp $ */
/* $OpenBSD: tmux.h,v 1.1232 2024/10/02 11:48:16 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -78,6 +78,9 @@ struct winlink;
#ifndef TMUX_SOCK
#define TMUX_SOCK "$TMUX_TMPDIR:" _PATH_TMP
#endif
#ifndef TMUX_SOCK_PERM
#define TMUX_SOCK_PERM (7 /* o+rwx */)
#endif
#ifndef TMUX_TERM
#define TMUX_TERM "screen"
#endif
@ -1311,8 +1314,7 @@ struct session {
struct options *options;
#define SESSION_PASTING 0x1
#define SESSION_ALERTED 0x2
#define SESSION_ALERTED 0x1
int flags;
u_int attached;
@ -1390,8 +1392,11 @@ struct mouse_event {
/* Key event. */
struct key_event {
key_code key;
struct mouse_event m;
key_code key;
struct mouse_event m;
char *buf;
size_t len;
};
/* Terminal definition. */
@ -1806,6 +1811,7 @@ struct client {
struct timeval creation_time;
struct timeval activity_time;
struct timeval last_activity_time;
struct environ *environ;
struct format_job_tree *jobs;
@ -1872,6 +1878,7 @@ struct client {
#define CLIENT_WINDOWSIZECHANGED 0x400000000ULL
#define CLIENT_CLIPBOARDBUFFER 0x800000000ULL
#define CLIENT_BRACKETPASTING 0x1000000000ULL
#define CLIENT_ASSUMEPASTING 0x2000000000ULL
#define CLIENT_ALLREDRAWFLAGS \
(CLIENT_REDRAWWINDOW| \
CLIENT_REDRAWSTATUS| \
@ -3010,6 +3017,7 @@ void screen_reinit(struct screen *);
void screen_free(struct screen *);
void screen_reset_tabs(struct screen *);
void screen_reset_hyperlinks(struct screen *);
void screen_set_default_cursor(struct screen *, struct options *);
void screen_set_cursor_style(u_int, enum screen_cursor_style *, int *);
void screen_set_cursor_colour(struct screen *, int);
int screen_set_title(struct screen *, const char *);
@ -3097,6 +3105,7 @@ void window_pane_reset_mode_all(struct window_pane *);
int window_pane_key(struct window_pane *, struct client *,
struct session *, struct winlink *, key_code,
struct mouse_event *);
void window_pane_paste(struct window_pane *, char *, size_t);
int window_pane_visible(struct window_pane *);
int window_pane_exited(struct window_pane *);
u_int window_pane_search(struct window_pane *, const char *, int,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tty-keys.c,v 1.179 2024/09/30 08:10:20 nicm Exp $ */
/* $OpenBSD: tty-keys.c,v 1.181 2024/10/03 05:41:59 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -944,9 +944,6 @@ complete_key:
if (bspace != _POSIX_VDISABLE && (key & KEYC_MASK_KEY) == bspace)
key = (key & KEYC_MASK_MODIFIERS)|KEYC_BSPACE;
/* Remove data from buffer. */
evbuffer_drain(tty->in, size);
/* Remove key timer. */
if (event_initialized(&tty->key_timer))
evtimer_del(&tty->key_timer);
@ -965,13 +962,23 @@ complete_key:
/* Fire the key. */
if (key != KEYC_UNKNOWN) {
event = xmalloc(sizeof *event);
event = xcalloc(1, sizeof *event);
event->key = key;
memcpy(&event->m, &m, sizeof event->m);
if (!server_client_handle_key(c, event))
event->buf = xmalloc(size);
event->len = size;
memcpy (event->buf, buf, event->len);
if (!server_client_handle_key(c, event)) {
free(event->buf);
free(event);
}
}
/* Remove data from buffer. */
evbuffer_drain(tty->in, size);
return (1);
discard_key:
@ -1009,7 +1016,7 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
u_int number, modifiers;
char tmp[64];
cc_t bspace;
key_code nkey;
key_code nkey, onlykey;
struct utf8_data ud;
utf8_char uc;
@ -1073,13 +1080,7 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
/* Update the modifiers. */
if (modifiers > 0) {
modifiers--;
/*
* The Shift modifier may not be reported in some input modes,
* which is unfortunate, as in general case determining if a
* character is shifted or not requires knowing the input
* keyboard layout. So we only fix up the trivial case.
*/
if (modifiers & 1 || (nkey >= 'A' && nkey <= 'Z'))
if (modifiers & 1)
nkey |= KEYC_SHIFT;
if (modifiers & 2)
nkey |= (KEYC_META|KEYC_IMPLIED_META); /* Alt */
@ -1093,6 +1094,26 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
if ((nkey & KEYC_MASK_KEY) == '\011' && (nkey & KEYC_SHIFT))
nkey = KEYC_BTAB | (nkey & ~KEYC_MASK_KEY & ~KEYC_SHIFT);
/*
* Deal with the Shift modifier when present alone. The problem is that
* in mode 2 some terminals would report shifted keys, like S-a, as
* just A, and some as S-A.
*
* Because we need an unambiguous internal representation, and because
* restoring the Shift modifier when it's missing would require knowing
* the keyboard layout, and because S-A would cause a lot of issues
* downstream, we choose to lose the Shift for all printable
* characters.
*
* That still leaves some ambiguity, such as C-S-A vs. C-A, but that's
* OK, and applications can handle that.
*/
onlykey = nkey & KEYC_MASK_KEY;
if (((onlykey > 0x20 && onlykey < 0x7f) ||
KEYC_IS_UNICODE(nkey)) &&
(nkey & KEYC_MASK_MODIFIERS) == KEYC_SHIFT)
nkey &= ~KEYC_SHIFT;
if (log_get_level() != 0) {
log_debug("%s: extended key %.*s is %llx (%s)", c->name,
(int)*size, buf, nkey, key_string_lookup_key(nkey, 1));

View file

@ -1,4 +1,4 @@
/* $OpenBSD: window-copy.c,v 1.353 2024/08/27 07:49:07 nicm Exp $ */
/* $OpenBSD: window-copy.c,v 1.354 2024/10/01 08:01:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -417,6 +417,7 @@ window_copy_common_init(struct window_mode_entry *wme)
data->jumpchar = NULL;
screen_init(&data->screen, screen_size_x(base), screen_size_y(base), 0);
screen_set_default_cursor(&data->screen, global_w_options);
data->modekeys = options_get_number(wp->window->options, "mode-keys");
evtimer_set(&data->dragtimer, window_copy_scroll_timer, wme);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: window.c,v 1.292 2024/08/26 07:14:40 nicm Exp $ */
/* $OpenBSD: window.c,v 1.294 2024/10/01 08:01:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -1154,6 +1154,24 @@ window_pane_reset_mode_all(struct window_pane *wp)
window_pane_reset_mode(wp);
}
static void
window_pane_copy_paste(struct window_pane *wp, char *buf, size_t len)
{
struct window_pane *loop;
TAILQ_FOREACH(loop, &wp->window->panes, entry) {
if (loop != wp &&
TAILQ_EMPTY(&loop->modes) &&
loop->fd != -1 &&
(~loop->flags & PANE_INPUTOFF) &&
window_pane_visible(loop) &&
options_get_number(loop->options, "synchronize-panes")) {
log_debug("%s: %.*s", __func__, (int)len, buf);
bufferevent_write(loop->event, buf, len);
}
}
}
static void
window_pane_copy_key(struct window_pane *wp, key_code key)
{
@ -1170,6 +1188,22 @@ window_pane_copy_key(struct window_pane *wp, key_code key)
}
}
void
window_pane_paste(struct window_pane *wp, char *buf, size_t len)
{
if (!TAILQ_EMPTY(&wp->modes))
return;
if (wp->fd == -1 || wp->flags & PANE_INPUTOFF)
return;
log_debug("%s: %.*s", __func__, (int)len, buf);
bufferevent_write(wp->event, buf, len);
if (options_get_number(wp->options, "synchronize-panes"))
window_pane_copy_paste(wp, buf, len);
}
int
window_pane_key(struct window_pane *wp, struct client *c, struct session *s,
struct winlink *wl, key_code key, struct mouse_event *m)
@ -1652,15 +1686,7 @@ window_set_fill_character(struct window *w)
void
window_pane_default_cursor(struct window_pane *wp)
{
struct screen *s = wp->screen;
int c;
c = options_get_number(wp->options, "cursor-colour");
s->default_ccolour = c;
c = options_get_number(wp->options, "cursor-style");
s->default_mode = 0;
screen_set_cursor_style(c, &s->default_cstyle, &s->default_mode);
screen_set_default_cursor(wp->screen, wp->options);
}
int