Skip to content

Commit c563d42

Browse files
committed
FEAT: optionally write any (molded) value into clipboard (by default disabled)
related to: Oldes/Rebol-issues#1619
1 parent 88b7f92 commit c563d42

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/core/p-clipboard.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,16 @@
104104
return R_RET;
105105

106106
case A_WRITE:
107-
if (!IS_STRING(arg) && !IS_BINARY(arg)) Trap1(RE_INVALID_PORT_ARG, arg);
107+
if (!(IS_STRING(arg) || IS_BINARY(arg))) {
108+
#ifdef WRITE_ANY_VALUE_TO_CLIPBOARD
109+
REB_MOLD mo = {0};
110+
Reset_Mold(&mo);
111+
Mold_Value(&mo, arg, TRUE);
112+
Set_String(arg, mo.series);
113+
#else
114+
Trap1(RE_INVALID_PORT_ARG, arg);
115+
#endif
116+
}
108117
// This device is opened on the WRITE:
109118
if (!IS_OPEN(req)) {
110119
if (OS_DO_DEVICE(req, RDC_OPEN)) Trap_Port(RE_CANNOT_OPEN, port, req->error);

0 commit comments

Comments
 (0)