diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-03-25 11:42:20 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-03-25 11:42:20 +0000 |
commit | 34f3b58de497f4f6dde4580bd55ee63344d8c5f8 (patch) | |
tree | f31911a32dfb0478cd8e69492756617096b5b2ad /usr.bin/tmux/cmd-capture-pane.c | |
parent | b27ff0b14fcd52e2057d95650f742638288db2c0 (diff) |
Handle empty pending output (not a failure) and add \n. From George
Nachman.
Diffstat (limited to 'usr.bin/tmux/cmd-capture-pane.c')
-rw-r--r-- | usr.bin/tmux/cmd-capture-pane.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-capture-pane.c b/usr.bin/tmux/cmd-capture-pane.c index 8234d8f332a..20d934367ac 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.23 2013/03/25 11:38:15 nicm Exp $ */ +/* $OpenBSD: cmd-capture-pane.c,v 1.24 2013/03/25 11:42:19 nicm Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net> @@ -69,7 +69,7 @@ cmd_capture_pane_pending(struct args *args, struct window_pane *wp, line = EVBUFFER_DATA(wp->ictx.since_ground); linelen = EVBUFFER_LENGTH(wp->ictx.since_ground); - buf = NULL; + buf = xstrdup(""); if (args_has(args, 'C')) { for (i = 0; i < linelen; i++) { if (line[i] >= ' ') { @@ -189,6 +189,8 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); } evbuffer_add(c->stdout_data, buf, len); + if (args_has(args, 'P') && len > 0) + evbuffer_add(c->stdout_data, "\n", 1); server_push_stdout(c); } else { limit = options_get_number(&global_options, "buffer-limit"); |