summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd-display-menu.c59
-rw-r--r--cmd-if-shell.c2
-rw-r--r--cmd-run-shell.c2
-rw-r--r--format.c2
-rw-r--r--job.c46
-rw-r--r--names.c2
-rw-r--r--popup.c207
-rw-r--r--spawn.c7
-rw-r--r--tmux.161
-rw-r--r--tmux.h19
-rw-r--r--window-copy.c4
11 files changed, 100 insertions, 311 deletions
diff --git a/cmd-display-menu.c b/cmd-display-menu.c
index ae000abe..27a4c1d7 100644
--- a/cmd-display-menu.c
+++ b/cmd-display-menu.c
@@ -18,6 +18,7 @@
#include <sys/types.h>
+#include <paths.h>
#include <stdlib.h>
#include <string.h>
@@ -50,10 +51,10 @@ const struct cmd_entry cmd_display_popup_entry = {
.name = "display-popup",
.alias = "popup",
- .args = { "CEKc:d:h:R:t:w:x:y:", 0, -1 },
- .usage = "[-CEK] [-c target-client] [-d start-directory] [-h height] "
- "[-R shell-command] " CMD_TARGET_PANE_USAGE " [-w width] "
- "[-x position] [-y position] [command line ...]",
+ .args = { "Cc:d:Eh:t:w:x:y:", 0, -1 },
+ .usage = "[-CE] [-c target-client] [-d start-directory] [-h height] "
+ CMD_TARGET_PANE_USAGE " [-w width] "
+ "[-x position] [-y position] [command]",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -325,13 +326,14 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
struct cmd_find_state *target = cmdq_get_target(item);
+ struct session *s = target->s;
struct client *tc = cmdq_get_target_client(item);
struct tty *tty = &tc->tty;
- const char *value, *cmd = NULL, **lines = NULL;
+ const char *value, *shell[] = { NULL, NULL };
const char *shellcmd = NULL;
- char *cwd, *cause;
- int flags = 0;
- u_int px, py, w, h, nlines = 0;
+ char *cwd, *cause, **argv = args->argv;
+ int flags = 0, argc = args->argc;
+ u_int px, py, w, h;
if (args_has(args, 'C')) {
server_client_clear_overlay(tc);
@@ -340,17 +342,7 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
if (tc->overlay_draw != NULL)
return (CMD_RETURN_NORMAL);
- if (args->argc >= 1)
- cmd = args->argv[0];
- if (args->argc >= 2) {
- lines = (const char **)args->argv + 1;
- nlines = args->argc - 1;
- }
-
- if (nlines != 0)
- h = popup_height(nlines, lines) + 2;
- else
- h = tty->sy / 2;
+ h = tty->sy / 2;
if (args_has(args, 'h')) {
h = args_percentage(args, 'h', 1, tty->sy, tty->sy, &cause);
if (cause != NULL) {
@@ -360,10 +352,7 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
}
}
- if (nlines != 0)
- w = popup_width(item, nlines, lines, tc, target) + 2;
- else
- w = tty->sx / 2;
+ w = tty->sx / 2;
if (args_has(args, 'w')) {
w = args_percentage(args, 'w', 1, tty->sx, tty->sx, &cause);
if (cause != NULL) {
@@ -384,20 +373,26 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
if (value != NULL)
cwd = format_single_from_target(item, value);
else
- cwd = xstrdup(server_client_get_cwd(tc, target->s));
-
- value = args_get(args, 'R');
- if (value != NULL)
- shellcmd = format_single_from_target(item, value);
+ cwd = xstrdup(server_client_get_cwd(tc, s));
+ if (argc == 0)
+ shellcmd = options_get_string(s->options, "default-command");
+ else if (argc == 1)
+ shellcmd = argv[0];
+ if (argc <= 1 && (shellcmd == NULL || *shellcmd == '\0')) {
+ shellcmd = NULL;
+ shell[0] = options_get_string(s->options, "default-shell");
+ if (!checkshell(shell[0]))
+ shell[0] = _PATH_BSHELL;
+ argc = 1;
+ argv = (char**)shell;
+ }
- if (args_has(args, 'K'))
- flags |= POPUP_WRITEKEYS;
if (args_has(args, 'E') > 1)
flags |= POPUP_CLOSEEXITZERO;
else if (args_has(args, 'E'))
flags |= POPUP_CLOSEEXIT;
- if (popup_display(flags, item, px, py, w, h, nlines, lines, shellcmd,
- cmd, cwd, tc, target, NULL, NULL) != 0)
+ if (popup_display(flags, item, px, py, w, h, shellcmd, argc, argv, cwd,
+ tc, s, NULL, NULL) != 0)
return (CMD_RETURN_NORMAL);
return (CMD_RETURN_WAIT);
}
diff --git a/cmd-if-shell.c b/cmd-if-shell.c
index d980472a..65fbf19b 100644
--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -128,7 +128,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
cdata->input.c->references++;
cmd_find_copy_state(&cdata->input.fs, target);
- if (job_run(shellcmd, s,
+ if (job_run(shellcmd, 0, NULL, s,
server_client_get_cwd(cmdq_get_client(item), s), NULL,
cmd_if_shell_callback, cmd_if_shell_free, cdata, 0, -1,
-1) == NULL) {
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index b259276d..4f30d05d 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -174,7 +174,7 @@ cmd_run_shell_timer(__unused int fd, __unused short events, void* arg)
enum cmd_parse_status status;
if (cmd != NULL && cdata->shell) {
- if (job_run(cmd, cdata->s, cdata->cwd, NULL,
+ if (job_run(cmd, 0, NULL, cdata->s, cdata->cwd, NULL,
cmd_run_shell_callback, cmd_run_shell_free, cdata,
cdata->flags, -1, -1) == NULL)
cmd_run_shell_free(cdata);
diff --git a/format.c b/format.c
index 9ecef751..d3c7508a 100644
--- a/format.c
+++ b/format.c
@@ -394,7 +394,7 @@ format_job_get(struct format_expand_state *es, const char *cmd)
if (force && fj->job != NULL)
job_free(fj->job);
if (force || (fj->job == NULL && fj->last != t)) {
- fj->job = job_run(expanded, NULL,
+ fj->job = job_run(expanded, 0, NULL, NULL,
server_client_get_cwd(ft->client, NULL), format_job_update,
format_job_complete, NULL, fj, JOB_NOWAIT, -1, -1);
if (fj->job == NULL) {
diff --git a/job.c b/job.c
index 5bf53a76..a1fc0cf5 100644
--- a/job.c
+++ b/job.c
@@ -66,19 +66,20 @@ struct job {
/* All jobs list. */
static LIST_HEAD(joblist, job) all_jobs = LIST_HEAD_INITIALIZER(all_jobs);
-/* Start a job running, if it isn't already. */
+/* Start a job running. */
struct job *
-job_run(const char *cmd, struct session *s, const char *cwd,
- job_update_cb updatecb, job_complete_cb completecb, job_free_cb freecb,
- void *data, int flags, int sx, int sy)
+job_run(const char *cmd, int argc, char **argv, struct session *s,
+ const char *cwd, job_update_cb updatecb, job_complete_cb completecb,
+ job_free_cb freecb, void *data, int flags, int sx, int sy)
{
- struct job *job;
- struct environ *env;
- pid_t pid;
- int nullfd, out[2], master;
- const char *home;
- sigset_t set, oldset;
- struct winsize ws;
+ struct job *job;
+ struct environ *env;
+ pid_t pid;
+ int nullfd, out[2], master;
+ const char *home;
+ sigset_t set, oldset;
+ struct winsize ws;
+ char **argvp;
/*
* Do not set TERM during .tmux.conf, it is nice to be able to use
@@ -99,7 +100,13 @@ job_run(const char *cmd, struct session *s, const char *cwd,
goto fail;
pid = fork();
}
- log_debug("%s: cmd=%s, cwd=%s", __func__, cmd, cwd == NULL ? "" : cwd);
+ if (cmd == NULL) {
+ cmd_log_argv(argc, argv, "%s:", __func__);
+ log_debug("%s: cwd=%s", __func__, cwd == NULL ? "" : cwd);
+ } else {
+ log_debug("%s: cmd=%s, cwd=%s", __func__, cmd,
+ cwd == NULL ? "" : cwd);
+ }
switch (pid) {
case -1:
@@ -139,8 +146,14 @@ job_run(const char *cmd, struct session *s, const char *cwd,
}
closefrom(STDERR_FILENO + 1);
- execl(_PATH_BSHELL, "sh", "-c", cmd, (char *) NULL);
- fatal("execl failed");
+ if (cmd != NULL) {
+ execl(_PATH_BSHELL, "sh", "-c", cmd, (char *) NULL);
+ fatal("execl failed");
+ } else {
+ argvp = cmd_copy_argv(argc, argv);
+ execvp(argvp[0], argvp);
+ fatal("execvp failed");
+ }
}
sigprocmask(SIG_SETMASK, &oldset, NULL);
@@ -150,7 +163,10 @@ job_run(const char *cmd, struct session *s, const char *cwd,
job->state = JOB_RUNNING;
job->flags = flags;
- job->cmd = xstrdup(cmd);
+ if (cmd != NULL)
+ job->cmd = xstrdup(cmd);
+ else
+ job->cmd = cmd_stringify_argv(argc, argv);
job->pid = pid;
job->status = 0;
diff --git a/names.c b/names.c
index f437b53e..09b33082 100644
--- a/names.c
+++ b/names.c
@@ -109,6 +109,8 @@ default_window_name(struct window *w)
{
char *cmd, *s;
+ if (w->active == NULL)
+ return (xstrdup(""));
cmd = cmd_stringify_argv(w->active->argc, w->active->argv);
if (cmd != NULL && *cmd != '\0')
s = parse_window_name(cmd);
diff --git a/popup.c b/popup.c
index 4db56495..509d182d 100644
--- a/popup.c
+++ b/popup.c
@@ -31,13 +31,7 @@ struct popup_data {
struct cmdq_item *item;
int flags;
- char **lines;
- u_int nlines;
-
- char *cmd;
- struct cmd_find_state fs;
struct screen s;
-
struct job *job;
struct input_ctx *ictx;
int status;
@@ -104,54 +98,11 @@ popup_init_ctx_cb(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx)
ttyctx->arg = pd;
}
-static void
-popup_write_screen(struct client *c, struct popup_data *pd)
-{
- struct cmdq_item *item = pd->item;
- struct screen_write_ctx ctx;
- char *copy, *next, *loop, *tmp;
- struct format_tree *ft;
- u_int i, y;
-
- ft = format_create(c, item, FORMAT_NONE, 0);
- if (cmd_find_valid_state(&pd->fs))
- format_defaults(ft, c, pd->fs.s, pd->fs.wl, pd->fs.wp);
- else
- format_defaults(ft, c, NULL, NULL, NULL);
-
- screen_write_start(&ctx, &pd->s);
- screen_write_clearscreen(&ctx, 8);
-
- y = 0;
- for (i = 0; i < pd->nlines; i++) {
- if (y == pd->sy - 2)
- break;
- copy = next = xstrdup(pd->lines[i]);
- while ((loop = strsep(&next, "\n")) != NULL) {
- if (y == pd->sy - 2)
- break;
- tmp = format_expand(ft, loop);
- screen_write_cursormove(&ctx, 0, y, 0);
- format_draw(&ctx, &grid_default_cell, pd->sx - 2, tmp,
- NULL);
- free(tmp);
- y++;
- }
- free(copy);
- }
-
- format_free(ft);
- screen_write_cursormove(&ctx, 0, y, 0);
- screen_write_stop(&ctx);
-}
-
static struct screen *
popup_mode_cb(struct client *c, u_int *cx, u_int *cy)
{
struct popup_data *pd = c->overlay_data;
- if (pd->ictx == NULL)
- return (0);
*cx = pd->px + 1 + pd->s.cx;
*cy = pd->py + 1 + pd->s.cy;
return (&pd->s);
@@ -199,14 +150,12 @@ popup_free_cb(struct client *c)
{
struct popup_data *pd = c->overlay_data;
struct cmdq_item *item = pd->item;
- u_int i;
if (pd->cb != NULL)
pd->cb(pd->status, pd->arg);
if (item != NULL) {
- if (pd->ictx != NULL &&
- cmdq_get_client(item) != NULL &&
+ if (cmdq_get_client(item) != NULL &&
cmdq_get_client(item)->session == NULL)
cmdq_get_client(item)->retval = pd->status;
cmdq_continue(item);
@@ -215,15 +164,9 @@ popup_free_cb(struct client *c)
if (pd->job != NULL)
job_free(pd->job);
- if (pd->ictx != NULL)
- input_free(pd->ictx);
-
- for (i = 0; i < pd->nlines; i++)
- free(pd->lines[i]);
- free(pd->lines);
+ input_free(pd->ictx);
screen_free(&pd->s);
- free(pd->cmd);
free(pd);
}
@@ -262,9 +205,7 @@ popup_handle_drag(struct client *c, struct popup_data *pd,
pd->sy = m->y - pd->py;
screen_resize(&pd->s, pd->sx - 2, pd->sy - 2, 0);
- if (pd->ictx == NULL)
- popup_write_screen(c, pd);
- else if (pd->job != NULL)
+ if (pd->job != NULL)
job_resize(pd->job, pd->sx - 2, pd->sy - 2);
server_redraw_client(c);
}
@@ -275,13 +216,8 @@ popup_key_cb(struct client *c, struct key_event *event)
{
struct popup_data *pd = c->overlay_data;
struct mouse_event *m = &event->m;
- struct cmd_find_state *fs = &pd->fs;
- struct format_tree *ft;
- const char *cmd, *buf;
+ const char *buf;
size_t len;
- struct cmdq_state *state;
- enum cmd_parse_status status;
- char *error;
if (KEYC_IS_MOUSE(event->key)) {
if (pd->dragging != OFF) {
@@ -313,13 +249,11 @@ popup_key_cb(struct client *c, struct key_event *event)
}
}
- if (pd->ictx != NULL && (pd->flags & POPUP_WRITEKEYS)) {
- if (((pd->flags & (POPUP_CLOSEEXIT|POPUP_CLOSEEXITZERO)) == 0 ||
- pd->job == NULL) &&
- (event->key == '\033' || event->key == '\003'))
- return (1);
- if (pd->job == NULL)
- return (0);
+ if ((((pd->flags & (POPUP_CLOSEEXIT|POPUP_CLOSEEXITZERO)) == 0) ||
+ pd->job == NULL) &&
+ (event->key == '\033' || event->key == '\003'))
+ return (1);
+ if (pd->job != NULL) {
if (KEYC_IS_MOUSE(event->key)) {
/* Must be inside, checked already. */
if (!input_key_get_mouse(&pd->s, m, m->x - pd->px - 1,
@@ -329,40 +263,8 @@ popup_key_cb(struct client *c, struct key_event *event)
return (0);
}
input_key(&pd->s, job_get_event(pd->job), event->key);
- return (0);
}
-
- if (pd->cmd == NULL)
- return (1);
-
- ft = format_create(NULL, pd->item, FORMAT_NONE, 0);
- if (cmd_find_valid_state(fs))
- format_defaults(ft, c, fs->s, fs->wl, fs->wp);
- else
- format_defaults(ft, c, NULL, NULL, NULL);
- format_add(ft, "popup_key", "%s", key_string_lookup_key(event->key, 0));
- if (KEYC_IS_MOUSE(event->key)) {
- format_add(ft, "popup_mouse", "1");
- format_add(ft, "popup_mouse_x", "%u", m->x - pd->px);
- format_add(ft, "popup_mouse_y", "%u", m->y - pd->py);
- }
- cmd = format_expand(ft, pd->cmd);
- format_free(ft);
-
- if (pd->item != NULL)
- event = cmdq_get_event(pd->item);
- else
- event = NULL;
- state = cmdq_new_state(&pd->fs, event, 0);
-
- status = cmd_parse_and_append(cmd, NULL, c, state, &error);
- if (status == CMD_PARSE_ERROR) {
- cmdq_append(c, cmdq_get_error(error));
- free(error);
- }
- cmdq_free_state(state);
-
- return (1);
+ return (0);
out:
pd->lx = m->x;
@@ -415,62 +317,12 @@ popup_job_complete_cb(struct job *job)
server_client_clear_overlay(pd->c);
}
-u_int
-popup_height(u_int nlines, const char **lines)
-{
- char *copy, *next, *loop;
- u_int i, height = 0;
-
- for (i = 0; i < nlines; i++) {
- copy = next = xstrdup(lines[i]);
- while ((loop = strsep(&next, "\n")) != NULL)
- height++;
- free(copy);
- }
-
- return (height);
-}
-
-u_int
-popup_width(struct cmdq_item *item, u_int nlines, const char **lines,
- struct client *c, struct cmd_find_state *fs)
-{
- char *copy, *next, *loop, *tmp;
- struct format_tree *ft;
- u_int i, width = 0, tmpwidth;
-
- ft = format_create(cmdq_get_client(item), item, FORMAT_NONE, 0);
- if (fs != NULL && cmd_find_valid_state(fs))
- format_defaults(ft, c, fs->s, fs->wl, fs->wp);
- else
- format_defaults(ft, c, NULL, NULL, NULL);
-
- for (i = 0; i < nlines; i++) {
- copy = next = xstrdup(lines[i]);
- while ((loop = strsep(&next, "\n")) != NULL) {
- tmp = format_expand(ft, loop);
- tmpwidth = format_width(tmp);
- if (tmpwidth > width)
- width = tmpwidth;
- free(tmp);
- }
- free(copy);
- }
-
- format_free(ft);
- return (width);
-}
-
int
popup_display(int flags, struct cmdq_item *item, u_int px, u_int py, u_int sx,
- u_int sy, u_int nlines, const char **lines, const char *shellcmd,
- const char *cmd, const char *cwd, struct client *c,
- struct cmd_find_state *fs, popup_close_cb cb, void *arg)
+ u_int sy, const char *shellcmd, int argc, char **argv, const char *cwd,
+ struct client *c, struct session *s, popup_close_cb cb, void *arg)
{
struct popup_data *pd;
- u_int i;
- struct session *s;
- int jobflags;
if (sx < 3 || sy < 3)
return (-1);
@@ -488,39 +340,17 @@ popup_display(int flags, struct cmdq_item *item, u_int px, u_int py, u_int sx,
pd->arg = arg;
pd->status = 128 + SIGHUP;
- if (fs != NULL)
- cmd_find_copy_state(&pd->fs, fs);
screen_init(&pd->s, sx - 2, sy - 2, 0);
- if (cmd != NULL)
- pd->cmd = xstrdup(cmd);
-
pd->px = px;
pd->py = py;
pd->sx = sx;
pd->sy = sy;
- pd->nlines = nlines;
- if (pd->nlines != 0)
- pd->lines = xreallocarray(NULL, pd->nlines, sizeof *pd->lines);
-
- for (i = 0; i < pd->nlines; i++)
- pd->lines[i] = xstrdup(lines[i]);
- popup_write_screen(c, pd);
-
- if (shellcmd != NULL) {
- if (fs != NULL)
- s = fs->s;
- else
- s = NULL;
- jobflags = JOB_NOWAIT|JOB_PTY;
- if (flags & POPUP_WRITEKEYS)
- jobflags |= JOB_KEEPWRITE;
- pd->job = job_run(shellcmd, s, cwd, popup_job_update_cb,
- popup_job_complete_cb, NULL, pd, jobflags, pd->sx - 2,
- pd->sy - 2);
- pd->ictx = input_init(NULL, job_get_event(pd->job));
- }
+ pd->job = job_run(shellcmd, argc, argv, s, cwd,
+ popup_job_update_cb, popup_job_complete_cb, NULL, pd,
+ JOB_NOWAIT|JOB_PTY|JOB_KEEPWRITE, pd->sx - 2, pd->sy - 2);
+ pd->ictx = input_init(NULL, job_get_event(pd->job));
server_client_set_overlay(c, 0, popup_check_cb, popup_mode_cb,
popup_draw_cb, popup_key_cb, popup_free_cb, pd);
@@ -606,9 +436,8 @@ popup_editor(struct client *c, const char *buf, size_t len,
py = (c->tty.sy / 2) - (sy / 2);
xasprintf(&cmd, "%s %s", editor, path);
- if (popup_display(POPUP_WRITEKEYS|POPUP_CLOSEEXIT, NULL, px, py, sx, sy,
- 0, NULL, cmd, NULL, _PATH_TMP, c, NULL, popup_editor_close_cb,
- pe) != 0) {
+ if (popup_display(POPUP_CLOSEEXIT, NULL, px, py, sx, sy, cmd, 0, NULL,
+ _PATH_TMP, c, NULL, popup_editor_close_cb, pe) != 0) {
popup_editor_free(pe);
free(cmd);
return (-1);
diff --git a/spawn.c b/spawn.c
index b9fe2a2d..c47b11f4 100644
--- a/spawn.c
+++ b/spawn.c
@@ -182,7 +182,7 @@ spawn_window(struct spawn_context *sc, char **cause)
NULL);
options_set_number(w->options, "automatic-rename", 0);
} else
- w->name = xstrdup(default_window_name(w));
+ w->name = default_window_name(w);
}
/* Switch to the new window if required. */
@@ -263,8 +263,9 @@ spawn_pane(struct spawn_context *sc, char **cause)
}
/*
- * Now we have a pane with nothing running in it ready for the new process.
- * Work out the command and arguments and store the working directory.
+ * Now we have a pane with nothing running in it ready for the new
+ * process. Work out the command and arguments and store the working
+ * directory.
*/
if (sc->argc == 0 && (~sc->flags & SPAWN_RESPAWN)) {
cmd = options_get_string(s->options, "default-command");
diff --git a/tmux.1 b/tmux.1
index a1bfbd25..4611cc20 100644
--- a/tmux.1
+++ b/tmux.1
@@ -4923,9 +4923,6 @@ The following variables are available, where appropriate:
.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
.It Li "pane_width" Ta "" Ta "Width of pane"
.It Li "pid" Ta "" Ta "Server PID"
-.It Li "popup_key" Ta "" Ta "Key pressed in popup"
-.It Li "popup_mouse_x" Ta "" Ta "Mouse X position in popup"
-.It Li "popup_mouse_y" Ta "" Ta "Mouse Y position in popup"
.It Li "rectangle_toggle" Ta "" Ta "1 if rectangle selection is activated"
.It Li "scroll_position" Ta "" Ta "Scroll position in copy mode"
.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
@@ -5584,58 +5581,24 @@ lists the format variables and their values.
forwards any input read from stdin to the empty pane given by
.Ar target-pane .
.It Xo Ic display-popup
-.Op Fl CEK
+.Op Fl CE
.Op Fl c Ar target-client
.Op Fl d Ar start-directory
.Op Fl h Ar height
-.Op Fl R Ar shell-command
.Op Fl t Ar target-pane
.Op Fl w Ar width
.Op Fl x Ar position
.Op Fl y Ar position
-.Op Ar command Ar line Ar ...
+.Op Ar shell-command
.Xc
.D1 (alias: Ic popup )
-Display a popup on
+Display a popup running
+.Ar shell-command
+on
.Ar target-client .
A popup is a rectangular box drawn over the top of any panes.
Panes are not updated while a popup is present.
-The popup content may be given in two ways:
-.Bl -enum -offset Ds
-.It
-A set of lines as arguments.
-Each line is a format which is expanded using
-.Ar target-pane
-as the target.
-If a line contains newlines it is split into multiple lines.
-Lines may use styles, see the
-.Sx STYLES
-section.
-.It
-A shell command given by
-.Fl R
-which is run and any output shown in the pane.
-.El
.Pp
-The first argument,
-.Ar command ,
-is a
-.Nm
-command which is run when a key is pressed.
-The key is available in the
-.Ql popup_key
-format.
-After
-.Ar command
-is run, the popup is closed.
-It may be empty to discard any key presses.
-If
-.Fl K
-is given together with
-.Fl R ,
-key presses are instead passed to the
-.Fl R
-shell command.
.Fl E
closes the popup automatically when
.Ar shell-command
@@ -5645,14 +5608,6 @@ Two
closes the popup only if
.Ar shell-command
exited with success.
-With
-.Fl K ,
-.Ql Escape
-and
-.Ql C-c
-close the popup unless
-.Fl E
-is also given.
.Pp
.Fl x
and
@@ -5665,11 +5620,7 @@ and
.Fl h
give the width and height - both may be a percentage (followed by
.Ql % ) .
-If omitted, without
-.Fl R
-they are calculated from the given lines and with
-.Fl R
-they use half the terminal size.
+If omitted, half of the terminal size is used.
.Pp
The
.Fl C
diff --git a/tmux.h b/tmux.h
index 401bf82f..69610940 100644
--- a/tmux.h
+++ b/tmux.h
@@ -2068,9 +2068,9 @@ typedef void (*job_free_cb) (void *);
#define JOB_NOWAIT 0x1
#define JOB_KEEPWRITE 0x2
#define JOB_PTY 0x4
-struct job *job_run(const char *, struct session *, const char *,
- job_update_cb, job_complete_cb, job_free_cb, void *, int,
- int, int);
+struct job *job_run(const char *, int, char **, struct session *,
+ const char *, job_update_cb, job_complete_cb, job_free_cb,
+ void *, int, int, int);
void job_free(struct job *);
void job_resize(struct job *, u_int, u_int);
void job_check_died(pid_t, int);
@@ -3040,18 +3040,13 @@ int menu_display(struct menu *, int, struct cmdq_item *, u_int,
menu_choice_cb, void *);
/* popup.c */
-#define POPUP_WRITEKEYS 0x1
-#define POPUP_CLOSEEXIT 0x2
-#define POPUP_CLOSEEXITZERO 0x4
+#define POPUP_CLOSEEXIT 0x1
+#define POPUP_CLOSEEXITZERO 0x2
typedef void (*popup_close_cb)(int, void *);
typedef void (*popup_finish_edit_cb)(char *, size_t, void *);
-u_int popup_width(struct cmdq_item *, u_int, const char **,
- struct client *, struct cmd_find_state *);
-u_int popup_height(u_int, const char **);
int popup_display(int, struct cmdq_item *, u_int, u_int, u_int,
- u_int, u_int, const char **, const char *, const char *,
- const char *, struct client *, struct cmd_find_state *,
- popup_close_cb, void *);
+ u_int, const char *, int, char **, const char *,
+ struct client *, struct session *, popup_close_cb, void *);
int popup_editor(struct client *, const char *, size_t,
popup_finish_edit_cb, void *);
diff --git a/window-copy.c b/window-copy.c
index 531431c8..4558ed48 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -3963,8 +3963,8 @@ window_copy_pipe_run(struct window_mode_entry *wme, struct session *s,
if (cmd == NULL || *cmd == '\0')
cmd = options_get_string(global_options, "copy-command");
if (cmd != NULL && *cmd != '\0') {
- job = job_run(cmd, s, NULL, NULL, NULL, NULL, NULL, JOB_NOWAIT,
- -1, -1);
+ job = job_run(cmd, 0, NULL, s, NULL, NULL, NULL, NULL, NULL,
+ JOB_NOWAIT, -1, -1);
bufferevent_write(job_get_event(job), buf, *len);
}
return (buf);