-/* $OpenBSD: job.c,v 1.61 2021/08/13 19:27:25 nicm Exp $ */
+/* $OpenBSD: job.c,v 1.62 2021/08/13 19:55:11 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
char *cmd;
pid_t pid;
+ char tty[TTY_NAME_MAX];
int status;
int fd;
const char *home;
sigset_t set, oldset;
struct winsize ws;
- char **argvp;
+ char **argvp, tty[TTY_NAME_MAX];
/*
* Do not set TERM during .tmux.conf, it is nice to be able to use
memset(&ws, 0, sizeof ws);
ws.ws_col = sx;
ws.ws_row = sy;
- pid = fdforkpty(ptm_fd, &master, NULL, NULL, &ws);
+ pid = fdforkpty(ptm_fd, &master, tty, NULL, &ws);
} else {
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, out) != 0)
goto fail;
else
job->cmd = cmd_stringify_argv(argc, argv);
job->pid = pid;
+ strlcpy(job->tty, tty, sizeof job->tty);
job->status = 0;
LIST_INSERT_HEAD(&all_jobs, job, entry);
/* Take job's file descriptor and free the job. */
int
-job_transfer(struct job *job)
+job_transfer(struct job *job, pid_t *pid, char *tty, size_t ttylen)
{
int fd = job->fd;
log_debug("transfer job %p: %s", job, job->cmd);
+ if (pid != NULL)
+ *pid = job->pid;
+ if (tty != NULL)
+ strlcpy(tty, job->tty, ttylen);
+
LIST_REMOVE(job, entry);
free(job->cmd);
-/* $OpenBSD: popup.c,v 1.29 2021/08/13 19:27:25 nicm Exp $ */
+/* $OpenBSD: popup.c,v 1.30 2021/08/13 19:55:11 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
{ "Fill Space", 'F', NULL },
{ "Centre", 'C', NULL },
{ "", KEYC_NONE, NULL },
- { "Make Pane (H)", 'h', NULL },
- { "Make Pane (V)", 'v', NULL },
+ { "To Horizontal Pane", 'h', NULL },
+ { "To Vertical Pane", 'v', NULL },
{ NULL, KEYC_NONE, NULL }
};
struct layout_cell *lc;
struct window_pane *wp = w->active, *new_wp;
u_int hlimit;
+ const char *shell;
window_unzoom(w);
new_wp = window_add_pane(wp->window, NULL, hlimit, 0);
layout_assign_pane(lc, new_wp, 0);
- new_wp->fd = job_transfer(pd->job);
+ new_wp->fd = job_transfer(pd->job, &new_wp->pid, new_wp->tty,
+ sizeof new_wp->tty);
pd->job = NULL;
+ screen_set_title(&pd->s, new_wp->base.title);
screen_free(&new_wp->base);
memcpy(&new_wp->base, &pd->s, sizeof wp->base);
screen_resize(&new_wp->base, new_wp->sx, new_wp->sy, 1);
screen_init(&pd->s, 1, 1, 0);
+ shell = options_get_string(s->options, "default-shell");
+ if (!checkshell(shell))
+ shell = _PATH_BSHELL;
+ new_wp->shell = xstrdup(shell);
+
window_pane_set_event(new_wp);
window_set_active_pane(w, new_wp, 1);
+ new_wp->flags |= PANE_CHANGED;
pd->close = 1;
}
-/* $OpenBSD: tmux.h,v 1.1121 2021/08/13 19:27:25 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1122 2021/08/13 19:55:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
const char *, job_update_cb, job_complete_cb, job_free_cb,
void *, int, int, int);
void job_free(struct job *);
-int job_transfer(struct job *);
+int job_transfer(struct job *, pid_t *, char *, size_t);
void job_resize(struct job *, u_int, u_int);
void job_check_died(pid_t, int);
int job_get_status(struct job *);