mirror of
https://github.com/tmux/tmux.git
synced 2026-03-06 07:45:35 +00:00
Pass which clipboard is set through to the terminal, from Axel Lindskog
in GitHub issue 4858.
This commit is contained in:
12
tty-keys.c
12
tty-keys.c
@@ -1310,7 +1310,7 @@ tty_keys_clipboard(struct tty *tty, const char *buf, size_t len, size_t *size)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
size_t end, terminator = 0, needed;
|
||||
char *copy, *out;
|
||||
char *copy, *out, clip = 0;
|
||||
int outlen;
|
||||
struct input_request_clipboard_data cd;
|
||||
|
||||
@@ -1360,7 +1360,14 @@ tty_keys_clipboard(struct tty *tty, const char *buf, size_t len, size_t *size)
|
||||
/* Adjust end so that it points to the start of the terminator. */
|
||||
end -= terminator - 1;
|
||||
|
||||
/* Get the second argument. */
|
||||
/*
|
||||
* Save which clipboard was used from the second argument. If more than
|
||||
* one is specified (should not happen), ignore the argument.
|
||||
*/
|
||||
if (end >= 2 && buf[0] != ';' && buf[1] == ';')
|
||||
clip = buf[0];
|
||||
|
||||
/* Skip the second argument. */
|
||||
while (end != 0 && *buf != ';') {
|
||||
buf++;
|
||||
end--;
|
||||
@@ -1393,6 +1400,7 @@ tty_keys_clipboard(struct tty *tty, const char *buf, size_t len, size_t *size)
|
||||
/* Set reply if any. */
|
||||
cd.buf = out;
|
||||
cd.len = outlen;
|
||||
cd.clip = clip;
|
||||
input_request_reply(c, INPUT_REQUEST_CLIPBOARD, &cd);
|
||||
|
||||
/* Create a buffer if requested. */
|
||||
|
||||
Reference in New Issue
Block a user