diff options
author | 2014-11-09 15:13:01 +0000 | |
---|---|---|
committer | 2014-11-09 15:13:01 +0000 | |
commit | b544cd5bbd4108167fb0dbc434ec4e1e624c81d6 (patch) | |
tree | 6eb853bc5cb378aa5b58c86b9780e32a56c8271a | |
parent | When a pipe is closed, clear the memory of the corresponding enpoint (diff) | |
download | wireguard-openbsd-b544cd5bbd4108167fb0dbc434ec4e1e624c81d6.tar.xz wireguard-openbsd-b544cd5bbd4108167fb0dbc434ec4e1e624c81d6.zip |
Expand formats in copy-pipe command, suggested by Suraj N Kurapati.
-rw-r--r-- | usr.bin/tmux/window-copy.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 4f6ac17adb7..dcdbe53cf14 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.119 2014/11/06 10:56:44 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.120 2014/11/09 15:13:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1479,18 +1479,28 @@ void window_copy_copy_pipe(struct window_pane *wp, struct session *sess, const char *bufname, const char *arg) { - void *buf; - size_t len; - struct job *job; - + void *buf; + size_t len; + struct job *job; + struct format_tree *ft; + char *expanded; buf = window_copy_get_selection(wp, &len); if (buf == NULL) return; - job = job_run(arg, sess, NULL, NULL, NULL); + ft = format_create(); + format_window_pane(ft, wp); + if (sess != NULL) + format_session(ft, sess); + expanded = format_expand(ft, arg); + + job = job_run(expanded, sess, NULL, NULL, NULL); bufferevent_write(job->event, buf, len); + free(expanded); + format_free(ft); + window_copy_copy_buffer(wp, bufname, buf, len); } |