Skip to content

Commit 4148634

Browse files
committed
ATRONIX: Make writing and reading clipboard symmetric
Write writes strings in unicode, so the data returned from read should also be in unicode. Copy_Os_Str expects the data to be native strings, which might not be in unicode
1 parent 3c7e7a8 commit 4148634

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

make/Rebol3.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/p-clipboard.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@
6363

6464
// Copy and set the string result:
6565
arg = OFV(port, STD_PORT_DATA);
66-
67-
// If wide, correct length:
66+
6867
len = req->actual;
69-
if (GET_FLAG(req->flags, RRF_WIDE)) len /= sizeof(REBUNI);
70-
71-
// Copy the string (convert to latin-8 if it fits):
72-
Set_String(arg, Copy_OS_Str(req->data, len));
68+
if (GET_FLAG(req->flags, RRF_WIDE)) {
69+
len /= sizeof(REBUNI); //correct length
70+
// Copy the string (convert to latin-8 if it fits):
71+
Set_String(arg, Copy_Wide_Str(req->data, len));
72+
} else {
73+
Set_String(arg, Copy_OS_Str(req->data, len));
74+
}
7375

7476
OS_FREE(req->data); // release the copy buffer
7577
req->data = 0;

0 commit comments

Comments
 (0)