From 5ab49de7f2aea28018c67ff4e646d68ad187f52d Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 19 Oct 2021 21:34:04 +0200 Subject: selection: convert \r -> \n when reading clipboard data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes an issue where pasting (using e.g. OSC-52) in client applications that doesn’t do this conversion themselves, like tmux, doesn’t work. Closes #752 --- selection.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'selection.c') diff --git a/selection.c b/selection.c index b6bae978..91523d3b 100644 --- a/selection.c +++ b/selection.c @@ -1609,6 +1609,11 @@ fdm_receive_timeout(struct fdm *fdm, int fd, int events, void *data) static void fdm_receive_decoder_plain(struct clipboard_receive *ctx, char *data, size_t size) { + /* \r -> \n */ + for (size_t i = 0; i < size; i++) { + if (data[i] == '\r') + data[i] = '\n'; + } ctx->cb(data, size, ctx->user); } -- cgit v1.3