From 274f8716e3c3c39a36f4ea8950f8db57c81b197b Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 25 Mar 2013 16:04:08 +0000 Subject: Try to establish client for run-shell and if-shell if no -t. --- usr.bin/tmux/cmd-if-shell.c | 11 ++++++++++- usr.bin/tmux/cmd-run-shell.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c index 01a5d974349..7704efd65d3 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.22 2013/03/25 11:43:01 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.23 2013/03/25 16:04:07 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -59,6 +59,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) struct args *args = self->args; struct cmd_if_shell_data *cdata; char *shellcmd; + struct client *c; struct session *s = NULL; struct winlink *wl = NULL; struct window_pane *wp = NULL; @@ -66,6 +67,14 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) if (args_has(args, 't')) wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); + else { + c = cmd_find_client(cmdq, NULL, 1); + if (c != NULL && c->session != NULL) { + s = c->session; + wl = s->curw; + wp = wl->window->active; + } + } ft = format_create(); if (s != NULL) diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c index 44e63162e90..18f93aea2b3 100644 --- a/usr.bin/tmux/cmd-run-shell.c +++ b/usr.bin/tmux/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.22 2013/03/25 11:43:01 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.23 2013/03/25 16:04:07 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -77,6 +77,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq) struct args *args = self->args; struct cmd_run_shell_data *cdata; char *shellcmd; + struct client *c; struct session *s = NULL; struct winlink *wl = NULL; struct window_pane *wp = NULL; @@ -84,6 +85,14 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq) if (args_has(args, 't')) wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp); + else { + c = cmd_find_client(cmdq, NULL, 1); + if (c != NULL && c->session != NULL) { + s = c->session; + wl = s->curw; + wp = wl->window->active; + } + } ft = format_create(); if (s != NULL) -- cgit v1.2.3