diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-03-22 15:53:25 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-03-22 15:53:25 +0000 |
commit | 8fa5a363d25830cbd59c3140b86f87c907e30158 (patch) | |
tree | 64dae4e4fd78db98237cf3820b1412556c8a9533 | |
parent | 50047bf5bd06d7e1c60053cb48afbb3e925b51c4 (diff) |
Fix so capture-pane/save-buffer can work in control clients, from George
Nachman.
-rw-r--r-- | usr.bin/tmux/cmd-capture-pane.c | 7 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-save-buffer.c | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd-capture-pane.c b/usr.bin/tmux/cmd-capture-pane.c index 8fcc8124471..0e4a79bc6cf 100644 --- a/usr.bin/tmux/cmd-capture-pane.c +++ b/usr.bin/tmux/cmd-capture-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-capture-pane.c,v 1.16 2013/03/22 15:51:54 nicm Exp $ */ +/* $OpenBSD: cmd-capture-pane.c,v 1.17 2013/03/22 15:53:24 nicm Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net> @@ -44,7 +44,7 @@ enum cmd_retval cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; - struct client *c = ctx->cmdclient; + struct client *c; struct window_pane *wp; char *buf, *line, *cause; struct screen *s; @@ -106,6 +106,9 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx) } if (args_has(args, 'p')) { + c = ctx->curclient; + if (c == NULL || !(c->flags & CLIENT_CONTROL)) + c = ctx->cmdclient; if (c == NULL) { ctx->error(ctx, "can't write to stdout"); return (CMD_RETURN_ERROR); diff --git a/usr.bin/tmux/cmd-save-buffer.c b/usr.bin/tmux/cmd-save-buffer.c index ef617f6974c..7322d5f3de6 100644 --- a/usr.bin/tmux/cmd-save-buffer.c +++ b/usr.bin/tmux/cmd-save-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-save-buffer.c,v 1.16 2012/07/11 07:10:15 nicm Exp $ */ +/* $OpenBSD: cmd-save-buffer.c,v 1.17 2013/03/22 15:53:24 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -45,7 +45,7 @@ enum cmd_retval cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; - struct client *c = ctx->cmdclient; + struct client *c; struct session *s; struct paste_buffer *pb; const char *path, *newpath, *wd; @@ -76,13 +76,17 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) path = args->argv[0]; if (strcmp(path, "-") == 0) { + c = ctx->curclient; + if (c == NULL || !(c->flags & CLIENT_CONTROL)) + c = ctx->cmdclient; if (c == NULL) { - ctx->error(ctx, "%s: can't write to stdout", path); + ctx->error(ctx, "can't write to stdout"); return (CMD_RETURN_ERROR); } evbuffer_add(c->stdout_data, pb->data, pb->size); server_push_stdout(c); } else { + c = ctx->cmdclient; if (c != NULL) wd = c->cwd; else if ((s = cmd_current_session(ctx, 0)) != NULL) { |