mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
7b8ececd8d
11
input.c
11
input.c
@ -2242,22 +2242,27 @@ static int
|
|||||||
input_dcs_dispatch(struct input_ctx *ictx)
|
input_dcs_dispatch(struct input_ctx *ictx)
|
||||||
{
|
{
|
||||||
struct window_pane *wp = ictx->wp;
|
struct window_pane *wp = ictx->wp;
|
||||||
|
struct options *oo = wp->options;
|
||||||
struct screen_write_ctx *sctx = &ictx->ctx;
|
struct screen_write_ctx *sctx = &ictx->ctx;
|
||||||
u_char *buf = ictx->input_buf;
|
u_char *buf = ictx->input_buf;
|
||||||
size_t len = ictx->input_len;
|
size_t len = ictx->input_len;
|
||||||
const char prefix[] = "tmux;";
|
const char prefix[] = "tmux;";
|
||||||
const u_int prefixlen = (sizeof prefix) - 1;
|
const u_int prefixlen = (sizeof prefix) - 1;
|
||||||
|
long long allow_passthrough = 0;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
if (ictx->flags & INPUT_DISCARD)
|
if (ictx->flags & INPUT_DISCARD)
|
||||||
return (0);
|
return (0);
|
||||||
if (!options_get_number(ictx->wp->options, "allow-passthrough"))
|
allow_passthrough = options_get_number(oo, "allow-passthrough");
|
||||||
|
if (!allow_passthrough)
|
||||||
return (0);
|
return (0);
|
||||||
log_debug("%s: \"%s\"", __func__, buf);
|
log_debug("%s: \"%s\"", __func__, buf);
|
||||||
|
|
||||||
if (len >= prefixlen && strncmp(buf, prefix, prefixlen) == 0)
|
if (len >= prefixlen && strncmp(buf, prefix, prefixlen) == 0) {
|
||||||
screen_write_rawstring(sctx, buf + prefixlen, len - prefixlen);
|
screen_write_rawstring(sctx, buf + prefixlen, len - prefixlen,
|
||||||
|
allow_passthrough == 2);
|
||||||
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,9 @@ static const char *options_table_detach_on_destroy_list[] = {
|
|||||||
static const char *options_table_extended_keys_list[] = {
|
static const char *options_table_extended_keys_list[] = {
|
||||||
"off", "on", "always", NULL
|
"off", "on", "always", NULL
|
||||||
};
|
};
|
||||||
|
static const char *options_table_allow_passthrough_list[] = {
|
||||||
|
"off", "on", "all", NULL
|
||||||
|
};
|
||||||
|
|
||||||
/* Status line format. */
|
/* Status line format. */
|
||||||
#define OPTIONS_TABLE_STATUS_FORMAT1 \
|
#define OPTIONS_TABLE_STATUS_FORMAT1 \
|
||||||
@ -803,11 +806,14 @@ const struct options_table_entry options_table[] = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{ .name = "allow-passthrough",
|
{ .name = "allow-passthrough",
|
||||||
.type = OPTIONS_TABLE_FLAG,
|
.type = OPTIONS_TABLE_CHOICE,
|
||||||
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
|
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
|
||||||
|
.choices = options_table_allow_passthrough_list,
|
||||||
.default_num = 0,
|
.default_num = 0,
|
||||||
.text = "Whether applications are allowed to use the escape sequence "
|
.text = "Whether applications are allowed to use the escape sequence "
|
||||||
"to bypass tmux."
|
"to bypass tmux. Can be 'off' (disallowed), 'on' (allowed "
|
||||||
|
"if the pane is visible), or 'all' (allowed even if the pane "
|
||||||
|
"is invisible)."
|
||||||
},
|
},
|
||||||
|
|
||||||
{ .name = "allow-rename",
|
{ .name = "allow-rename",
|
||||||
|
@ -2100,13 +2100,15 @@ screen_write_setselection(struct screen_write_ctx *ctx, const char *flags,
|
|||||||
|
|
||||||
/* Write unmodified string. */
|
/* Write unmodified string. */
|
||||||
void
|
void
|
||||||
screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len)
|
screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len,
|
||||||
|
int allow_invisible_panes)
|
||||||
{
|
{
|
||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx, 0);
|
screen_write_initctx(ctx, &ttyctx, 0);
|
||||||
ttyctx.ptr = str;
|
ttyctx.ptr = str;
|
||||||
ttyctx.num = len;
|
ttyctx.num = len;
|
||||||
|
ttyctx.allow_invisible_panes = allow_invisible_panes;
|
||||||
|
|
||||||
tty_write(tty_cmd_rawstring, &ttyctx);
|
tty_write(tty_cmd_rawstring, &ttyctx);
|
||||||
}
|
}
|
||||||
|
8
tmux.1
8
tmux.1
@ -4464,11 +4464,17 @@ Available pane options are:
|
|||||||
.Pp
|
.Pp
|
||||||
.Bl -tag -width Ds -compact
|
.Bl -tag -width Ds -compact
|
||||||
.It Xo Ic allow-passthrough
|
.It Xo Ic allow-passthrough
|
||||||
.Op Ic on | off
|
.Op Ic on | off | all
|
||||||
.Xc
|
.Xc
|
||||||
Allow programs in the pane to bypass
|
Allow programs in the pane to bypass
|
||||||
.Nm
|
.Nm
|
||||||
using a terminal escape sequence (\eePtmux;...\ee\e\e).
|
using a terminal escape sequence (\eePtmux;...\ee\e\e).
|
||||||
|
If set to
|
||||||
|
.Ic on ,
|
||||||
|
passthrough sequences will be allowed only if the pane is visible.
|
||||||
|
If set to
|
||||||
|
.Ic all ,
|
||||||
|
they will be allowed even if the pane is invisible.
|
||||||
.Pp
|
.Pp
|
||||||
.It Xo Ic allow-rename
|
.It Xo Ic allow-rename
|
||||||
.Op Ic on | off
|
.Op Ic on | off
|
||||||
|
46
tmux.h
46
tmux.h
@ -1432,38 +1432,45 @@ struct tty_ctx {
|
|||||||
void *ptr;
|
void *ptr;
|
||||||
void *ptr2;
|
void *ptr2;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Whether this command should be sent even when the pane is not
|
||||||
|
* visible (used for a passthrough sequence when allow-passthrough is
|
||||||
|
* "all").
|
||||||
|
*/
|
||||||
|
int allow_invisible_panes;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cursor and region position before the screen was updated - this is
|
* Cursor and region position before the screen was updated - this is
|
||||||
* where the command should be applied; the values in the screen have
|
* where the command should be applied; the values in the screen have
|
||||||
* already been updated.
|
* already been updated.
|
||||||
*/
|
*/
|
||||||
u_int ocx;
|
u_int ocx;
|
||||||
u_int ocy;
|
u_int ocy;
|
||||||
|
|
||||||
u_int orupper;
|
u_int orupper;
|
||||||
u_int orlower;
|
u_int orlower;
|
||||||
|
|
||||||
/* Target region (usually pane) offset and size. */
|
/* Target region (usually pane) offset and size. */
|
||||||
u_int xoff;
|
u_int xoff;
|
||||||
u_int yoff;
|
u_int yoff;
|
||||||
u_int rxoff;
|
u_int rxoff;
|
||||||
u_int ryoff;
|
u_int ryoff;
|
||||||
u_int sx;
|
u_int sx;
|
||||||
u_int sy;
|
u_int sy;
|
||||||
|
|
||||||
/* The background colour used for clearing (erasing). */
|
/* The background colour used for clearing (erasing). */
|
||||||
u_int bg;
|
u_int bg;
|
||||||
|
|
||||||
/* The default colours and palette. */
|
/* The default colours and palette. */
|
||||||
struct grid_cell defaults;
|
struct grid_cell defaults;
|
||||||
struct colour_palette *palette;
|
struct colour_palette *palette;
|
||||||
|
|
||||||
/* Containing region (usually window) offset and size. */
|
/* Containing region (usually window) offset and size. */
|
||||||
int bigger;
|
int bigger;
|
||||||
u_int wox;
|
u_int wox;
|
||||||
u_int woy;
|
u_int woy;
|
||||||
u_int wsx;
|
u_int wsx;
|
||||||
u_int wsy;
|
u_int wsy;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Saved message entry. */
|
/* Saved message entry. */
|
||||||
@ -2891,7 +2898,8 @@ void screen_write_collect_add(struct screen_write_ctx *,
|
|||||||
void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *);
|
void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *);
|
||||||
void screen_write_setselection(struct screen_write_ctx *, const char *,
|
void screen_write_setselection(struct screen_write_ctx *, const char *,
|
||||||
u_char *, u_int);
|
u_char *, u_int);
|
||||||
void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int);
|
void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int,
|
||||||
|
int);
|
||||||
void screen_write_alternateon(struct screen_write_ctx *,
|
void screen_write_alternateon(struct screen_write_ctx *,
|
||||||
struct grid_cell *, int);
|
struct grid_cell *, int);
|
||||||
void screen_write_alternateoff(struct screen_write_ctx *,
|
void screen_write_alternateoff(struct screen_write_ctx *,
|
||||||
|
21
tty.c
21
tty.c
@ -1626,13 +1626,20 @@ tty_write(void (*cmdfn)(struct tty *, const struct tty_ctx *),
|
|||||||
if (ctx->set_client_cb == NULL)
|
if (ctx->set_client_cb == NULL)
|
||||||
return;
|
return;
|
||||||
TAILQ_FOREACH(c, &clients, entry) {
|
TAILQ_FOREACH(c, &clients, entry) {
|
||||||
if (!tty_client_ready(c))
|
if (ctx->allow_invisible_panes) {
|
||||||
continue;
|
if (c->session == NULL ||
|
||||||
state = ctx->set_client_cb(ctx, c);
|
c->tty.term == NULL ||
|
||||||
if (state == -1)
|
c->flags & CLIENT_SUSPENDED)
|
||||||
break;
|
continue;
|
||||||
if (state == 0)
|
} else {
|
||||||
continue;
|
if (!tty_client_ready(c))
|
||||||
|
continue;
|
||||||
|
state = ctx->set_client_cb(ctx, c);
|
||||||
|
if (state == -1)
|
||||||
|
break;
|
||||||
|
if (state == 0)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
cmdfn(&c->tty, ctx);
|
cmdfn(&c->tty, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user