summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 16:04:08 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 16:04:08 +0000
commit274f8716e3c3c39a36f4ea8950f8db57c81b197b (patch)
tree93ecf4430eb74cb91273750d1d08fe6ee62d0827 /usr.bin
parent70f9a624f789799fd8f194e22c02586549b30e9b (diff)
Try to establish client for run-shell and if-shell if no -t.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-if-shell.c11
-rw-r--r--usr.bin/tmux/cmd-run-shell.c11
2 files changed, 20 insertions, 2 deletions
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 <me@tiagocunha.org>
@@ -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 <me@tiagocunha.org>
@@ -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)