diff options
author | nicm <nicm> | 2020-09-02 13:46:35 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-09-02 13:46:35 +0000 |
commit | 37b1600d9cf7076498760372dcc20f021e4c181a (patch) | |
tree | 32aac8e0a121c649164f61127cb014703cd6c1e8 /cmd-set-buffer.c | |
parent | 60860aced8d424ef6c1d527b63842a0ea0f452ad (diff) | |
download | rtmux-37b1600d9cf7076498760372dcc20f021e4c181a.tar.gz rtmux-37b1600d9cf7076498760372dcc20f021e4c181a.tar.bz2 rtmux-37b1600d9cf7076498760372dcc20f021e4c181a.zip |
Add a -w flag to set- and load-buffer to send to clipboard using OSC 52.
GitHub issue 2363.
Diffstat (limited to 'cmd-set-buffer.c')
-rw-r--r-- | cmd-set-buffer.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c index 0f3fffce..94d8cd52 100644 --- a/cmd-set-buffer.c +++ b/cmd-set-buffer.c @@ -33,10 +33,11 @@ const struct cmd_entry cmd_set_buffer_entry = { .name = "set-buffer", .alias = "setb", - .args = { "ab:n:", 0, 1 }, - .usage = "[-a] " CMD_BUFFER_USAGE " [-n new-buffer-name] data", + .args = { "ab:t:n:w", 0, 1 }, + .usage = "[-aw] " CMD_BUFFER_USAGE " [-n new-buffer-name] " + CMD_TARGET_CLIENT_USAGE " data", - .flags = CMD_AFTERHOOK, + .flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG|CMD_CLIENT_CANFAIL, .exec = cmd_set_buffer_exec }; @@ -55,6 +56,7 @@ static enum cmd_retval cmd_set_buffer_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = cmd_get_args(self); + struct client *tc = cmdq_get_target_client(item); struct paste_buffer *pb; char *bufdata, *cause; const char *bufname, *olddata; @@ -118,6 +120,8 @@ cmd_set_buffer_exec(struct cmd *self, struct cmdq_item *item) free(cause); return (CMD_RETURN_ERROR); } + if (args_has(args, 'w') && tc != NULL) + tty_set_selection(&tc->tty, bufdata, bufsize); return (CMD_RETURN_NORMAL); } |