diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-06-12 08:47:08 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-06-12 08:47:08 +0000 |
commit | 616a9dc6d8f641d0e53fc9b81ea9d9a1ceef00fd (patch) | |
tree | 19d5f7d0007b0e28dff764997cdfbdeecdbc5293 | |
parent | 2683786416d4c08a386b544c9a260cb55c313125 (diff) |
Pass target on to new commands with if -F.
-rw-r--r-- | usr.bin/tmux/cmd-if-shell.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c index a625b0c26c1..7c366f3c179 100644 --- a/usr.bin/tmux/cmd-if-shell.c +++ b/usr.bin/tmux/cmd-if-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-if-shell.c,v 1.62 2019/05/25 07:15:53 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.63 2019/06/12 08:47:07 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -67,10 +67,11 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) struct cmd_if_shell_data *cdata; char *shellcmd, *cmd; struct cmdq_item *new_item; + struct cmd_find_state *fs = &item->target; struct client *c = cmd_find_client(item, NULL, 1); - struct session *s = item->target.s; - struct winlink *wl = item->target.wl; - struct window_pane *wp = item->target.wp; + struct session *s = fs->s; + struct winlink *wl = fs->wl; + struct window_pane *wp = fs->wp; struct cmd_parse_input pi; struct cmd_parse_result *pr; @@ -92,7 +93,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) pi.line = self->line; pi.item = item; pi.c = c; - cmd_find_copy_state(&pi.fs, &item->target); + cmd_find_copy_state(&pi.fs, fs); pr = cmd_parse_from_string(cmd, &pi); switch (pr->status) { @@ -103,7 +104,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) free(pr->error); return (CMD_RETURN_ERROR); case CMD_PARSE_SUCCESS: - new_item = cmdq_get_command(pr->cmdlist, NULL, m, 0); + new_item = cmdq_get_command(pr->cmdlist, fs, m, 0); cmdq_insert_after(item, new_item); cmd_list_free(pr->cmdlist); break; @@ -137,7 +138,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) cdata->input.c = c; if (cdata->input.c != NULL) cdata->input.c->references++; - cmd_find_copy_state(&cdata->input.fs, &item->target); + cmd_find_copy_state(&cdata->input.fs, fs); if (job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL, cmd_if_shell_callback, cmd_if_shell_free, cdata, 0) == NULL) { |