Merge branch 'master' into floating_panes

This commit is contained in:
Michael Grant
2026-03-09 08:31:58 +00:00
7 changed files with 29 additions and 7 deletions

View File

@@ -370,7 +370,7 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
flags |= MENU_NOMOUSE; flags |= MENU_NOMOUSE;
if (menu_display(menu, flags, starting_choice, item, px, py, tc, lines, if (menu_display(menu, flags, starting_choice, item, px, py, tc, lines,
style, selected_style, border_style, target, NULL, NULL) != 0) style, selected_style, border_style, target, NULL, NULL) != 0)
return (CMD_RETURN_NORMAL); goto out;
return (CMD_RETURN_WAIT); return (CMD_RETURN_WAIT);
out: out:

View File

@@ -123,7 +123,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
/* Fork the child. */ /* Fork the child. */
sigfillset(&set); sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, &oldset); sigprocmask(SIG_BLOCK, &set, &oldset);
switch (fork()) { switch ((wp->pipe_pid = fork())) {
case -1: case -1:
sigprocmask(SIG_SETMASK, &oldset, NULL); sigprocmask(SIG_SETMASK, &oldset, NULL);
cmdq_error(item, "fork error: %s", strerror(errno)); cmdq_error(item, "fork error: %s", strerror(errno));
@@ -136,6 +136,9 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
sigprocmask(SIG_SETMASK, &oldset, NULL); sigprocmask(SIG_SETMASK, &oldset, NULL);
close(pipe_fd[0]); close(pipe_fd[0]);
if (setpgid(0, 0) == -1)
_exit(1);
null_fd = open(_PATH_DEVNULL, O_WRONLY); null_fd = open(_PATH_DEVNULL, O_WRONLY);
if (out) { if (out) {
if (dup2(pipe_fd[1], STDIN_FILENO) == -1) if (dup2(pipe_fd[1], STDIN_FILENO) == -1)

View File

@@ -2253,6 +2253,17 @@ format_cb_pane_pipe(struct format_tree *ft)
return (NULL); return (NULL);
} }
/* Callback for pane_pipe_pid. */
static void *
format_cb_pane_pipe_pid(struct format_tree *ft)
{
char *value = NULL;
if (ft->wp != NULL && ft->wp->pipe_fd != -1)
xasprintf(&value, "%ld", (long)ft->wp->pipe_pid);
return (value);
}
/* Callback for pane_right. */ /* Callback for pane_right. */
static void * static void *
format_cb_pane_right(struct format_tree *ft) format_cb_pane_right(struct format_tree *ft)
@@ -3346,6 +3357,9 @@ static const struct format_table_entry format_table[] = {
{ "pane_pipe", FORMAT_TABLE_STRING, { "pane_pipe", FORMAT_TABLE_STRING,
format_cb_pane_pipe format_cb_pane_pipe
}, },
{ "pane_pipe_pid", FORMAT_TABLE_STRING,
format_cb_pane_pipe_pid
},
{ "pane_right", FORMAT_TABLE_STRING, { "pane_right", FORMAT_TABLE_STRING,
format_cb_pane_right format_cb_pane_right
}, },

11
grid.c
View File

@@ -495,7 +495,7 @@ static void
grid_expand_line(struct grid *gd, u_int py, u_int sx, u_int bg) grid_expand_line(struct grid *gd, u_int py, u_int sx, u_int bg)
{ {
struct grid_line *gl; struct grid_line *gl;
u_int xx, old_cellsize; u_int xx;
gl = &gd->linedata[py]; gl = &gd->linedata[py];
if (sx <= gl->cellsize) if (sx <= gl->cellsize)
@@ -508,10 +508,13 @@ grid_expand_line(struct grid *gd, u_int py, u_int sx, u_int bg)
else if (gd->sx > sx) else if (gd->sx > sx)
sx = gd->sx; sx = gd->sx;
old_cellsize = gl->cellsize; gl->celldata = xreallocarray(gl->celldata, sx,
gl->celldata = xrecallocarray(gl->celldata, old_cellsize, sx,
sizeof *gl->celldata); sizeof *gl->celldata);
for (xx = old_cellsize; xx < sx; xx++) if (gl->cellsize < sx) {
memset(gl->celldata + gl->cellsize, 0,
(sx - gl->cellsize) * sizeof *gl->celldata);
}
for (xx = gl->cellsize; xx < sx; xx++)
grid_clear_cell(gd, xx, py, bg); grid_clear_cell(gd, xx, py, bg);
gl->cellsize = sx; gl->cellsize = sx;
} }

View File

@@ -3752,7 +3752,7 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
c->term_name = xstrdup("unknown"); c->term_name = xstrdup("unknown");
} }
if (c->ttyname == NULL || *c->ttyname != '\0') if (c->ttyname != NULL && *c->ttyname != '\0')
name = xstrdup(c->ttyname); name = xstrdup(c->ttyname);
else else
xasprintf(&name, "client-%ld", (long)c->pid); xasprintf(&name, "client-%ld", (long)c->pid);

1
tmux.1
View File

@@ -6326,6 +6326,7 @@ The following variables are available, where appropriate:
.It Li "pane_path" Ta "" Ta "Path of pane (can be set by application)" .It Li "pane_path" Ta "" Ta "Path of pane (can be set by application)"
.It Li "pane_pid" Ta "" Ta "PID of first process in pane" .It Li "pane_pid" Ta "" Ta "PID of first process in pane"
.It Li "pane_pipe" Ta "" Ta "1 if pane is being piped" .It Li "pane_pipe" Ta "" Ta "1 if pane is being piped"
.It Li "pane_pipe_pid" Ta "" Ta "PID of pipe process, if any"
.It Li "pane_right" Ta "" Ta "Right of pane" .It Li "pane_right" Ta "" Ta "Right of pane"
.It Li "pane_search_string" Ta "" Ta "Last search string in copy mode" .It Li "pane_search_string" Ta "" Ta "Last search string in copy mode"
.It Li "pane_start_command" Ta "" Ta "Command pane started with" .It Li "pane_start_command" Ta "" Ta "Command pane started with"

1
tmux.h
View File

@@ -1261,6 +1261,7 @@ struct window_pane {
enum client_theme last_theme; enum client_theme last_theme;
int pipe_fd; int pipe_fd;
pid_t pipe_pid;
struct bufferevent *pipe_event; struct bufferevent *pipe_event;
struct window_pane_offset pipe_offset; struct window_pane_offset pipe_offset;