Skip to content

Commit

Permalink
Clipboard: handle multiple CR+LF
Browse files Browse the repository at this point in the history
  • Loading branch information
Kostiantyn Syrykh committed Mar 25, 2024
1 parent 786aba6 commit 9a1b1f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions tests/test.rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 9a1b1f0

Please sign in to comment.