=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-capture-pane.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- src/usr.bin/tmux/cmd-capture-pane.c 2013/03/22 15:51:54 1.16 +++ src/usr.bin/tmux/cmd-capture-pane.c 2013/03/22 15:53:24 1.17 @@ -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 @@ -44,7 +44,7 @@ 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 @@ } 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);