From 9a1b1f0d06567739251314a3b67ac5c432ecad47 Mon Sep 17 00:00:00 2001 From: Kostiantyn Syrykh Date: Mon, 25 Mar 2024 17:35:28 +0200 Subject: [PATCH] Clipboard: handle multiple CR+LF --- core/rfb.js | 2 +- tests/test.rfb.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/rfb.js b/core/rfb.js index c71d6b88f..f2deb0e7b 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -2356,7 +2356,7 @@ export default class RFB extends EventTargetMixin { textData = textData.slice(0, -1); } - textData = textData.replace("\r\n", "\n"); + textData = textData.replaceAll("\r\n", "\n"); this.dispatchEvent(new CustomEvent( "clipboard", diff --git a/tests/test.rfb.js b/tests/test.rfb.js index c1ee8b16d..62b80ca3f 100644 --- a/tests/test.rfb.js +++ b/tests/test.rfb.js @@ -3263,11 +3263,11 @@ describe('Remote Frame Buffer Protocol Client', function () { }); it('should update clipboard with correct escape characters from a Provide message ', function () { - let expectedData = "Oh\nmy!"; + let expectedData = "Oh\nmy\n!"; let data = [3, 0, 0, 0]; const flags = [0x10, 0x00, 0x00, 0x01]; - let text = encodeUTF8("Oh\r\nmy!\0"); + let text = encodeUTF8("Oh\r\nmy\r\n!\0"); let deflatedText = deflateWithSize(text);