mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 11:18:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
526e860a7a
@ -50,6 +50,9 @@ const struct cmd_entry cmd_if_shell_entry = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct cmd_if_shell_data {
|
struct cmd_if_shell_data {
|
||||||
|
char *file;
|
||||||
|
u_int line;
|
||||||
|
|
||||||
char *cmd_if;
|
char *cmd_if;
|
||||||
char *cmd_else;
|
char *cmd_else;
|
||||||
|
|
||||||
@ -106,7 +109,11 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
cdata = xmalloc(sizeof *cdata);
|
cdata = xcalloc(1, sizeof *cdata);
|
||||||
|
if (self->file != NULL) {
|
||||||
|
cdata->file = xstrdup(self->file);
|
||||||
|
cdata->line = self->line;
|
||||||
|
}
|
||||||
|
|
||||||
cdata->cmd_if = xstrdup(args->argv[1]);
|
cdata->cmd_if = xstrdup(args->argv[1]);
|
||||||
if (args->argc == 3)
|
if (args->argc == 3)
|
||||||
@ -148,7 +155,8 @@ cmd_if_shell_callback(struct job *job)
|
|||||||
if (cmd == NULL)
|
if (cmd == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cmd_string_parse(cmd, &cmdlist, NULL, 0, &cause) != 0) {
|
if (cmd_string_parse(cmd, &cmdlist, cdata->file, cdata->line,
|
||||||
|
&cause) != 0) {
|
||||||
if (cause != NULL) {
|
if (cause != NULL) {
|
||||||
cmdq_error(cmdq, "%s", cause);
|
cmdq_error(cmdq, "%s", cause);
|
||||||
free(cause);
|
free(cause);
|
||||||
@ -184,6 +192,8 @@ cmd_if_shell_done(struct cmd_q *cmdq1)
|
|||||||
|
|
||||||
free(cdata->cmd_else);
|
free(cdata->cmd_else);
|
||||||
free(cdata->cmd_if);
|
free(cdata->cmd_if);
|
||||||
|
|
||||||
|
free(cdata->file);
|
||||||
free(cdata);
|
free(cdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,5 +211,7 @@ cmd_if_shell_free(void *data)
|
|||||||
|
|
||||||
free(cdata->cmd_else);
|
free(cdata->cmd_else);
|
||||||
free(cdata->cmd_if);
|
free(cdata->cmd_if);
|
||||||
|
|
||||||
|
free(cdata->file);
|
||||||
free(cdata);
|
free(cdata);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
shellcmd = format_expand(ft, args->argv[0]);
|
shellcmd = format_expand(ft, args->argv[0]);
|
||||||
format_free(ft);
|
format_free(ft);
|
||||||
|
|
||||||
cdata = xmalloc(sizeof *cdata);
|
cdata = xcalloc(1, sizeof *cdata);
|
||||||
cdata->cmd = shellcmd;
|
cdata->cmd = shellcmd;
|
||||||
cdata->bflag = args_has(args, 'b');
|
cdata->bflag = args_has(args, 'b');
|
||||||
cdata->wp_id = wp != NULL ? (int) wp->id : -1;
|
cdata->wp_id = wp != NULL ? (int) wp->id : -1;
|
||||||
|
@ -232,6 +232,7 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr,
|
|||||||
struct winlink *wl = cmdq->state.tflag.wl;
|
struct winlink *wl = cmdq->state.tflag.wl;
|
||||||
struct options *oo;
|
struct options *oo;
|
||||||
struct options_entry *o;
|
struct options_entry *o;
|
||||||
|
const char *target;
|
||||||
|
|
||||||
if (args_has(args, 's'))
|
if (args_has(args, 's'))
|
||||||
oo = global_options;
|
oo = global_options;
|
||||||
@ -239,12 +240,28 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr,
|
|||||||
self->entry == &cmd_set_window_option_entry) {
|
self->entry == &cmd_set_window_option_entry) {
|
||||||
if (args_has(self->args, 'g'))
|
if (args_has(self->args, 'g'))
|
||||||
oo = global_w_options;
|
oo = global_w_options;
|
||||||
else
|
else if (wl == NULL) {
|
||||||
|
target = args_get(args, 't');
|
||||||
|
if (target != NULL) {
|
||||||
|
cmdq_error(cmdq, "no such window: %s",
|
||||||
|
target);
|
||||||
|
} else
|
||||||
|
cmdq_error(cmdq, "no current window");
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
} else
|
||||||
oo = wl->window->options;
|
oo = wl->window->options;
|
||||||
} else {
|
} else {
|
||||||
if (args_has(self->args, 'g'))
|
if (args_has(self->args, 'g'))
|
||||||
oo = global_s_options;
|
oo = global_s_options;
|
||||||
else
|
else if (s == NULL) {
|
||||||
|
target = args_get(args, 't');
|
||||||
|
if (target != NULL) {
|
||||||
|
cmdq_error(cmdq, "no such session: %s",
|
||||||
|
target);
|
||||||
|
} else
|
||||||
|
cmdq_error(cmdq, "no current session");
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
} else
|
||||||
oo = s->options;
|
oo = s->options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1288,7 +1288,8 @@ window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx,
|
|||||||
xoff = size = xsnprintf(hdr, limit,
|
xoff = size = xsnprintf(hdr, limit,
|
||||||
"Repeat: %d", data->numprefix);
|
"Repeat: %d", data->numprefix);
|
||||||
} else {
|
} else {
|
||||||
xoff = size = xsnprintf(hdr, limit,
|
/* We don't care about truncation. */
|
||||||
|
xoff = size = snprintf(hdr, limit,
|
||||||
"%s: %s", data->inputprompt, data->inputstr);
|
"%s: %s", data->inputprompt, data->inputstr);
|
||||||
}
|
}
|
||||||
screen_write_cursormove(ctx, 0, last);
|
screen_write_cursormove(ctx, 0, last);
|
||||||
|
Loading…
Reference in New Issue
Block a user