Skip to content

Commit

Permalink
FEAT: optionally write any (molded) value into clipboard (by default …
Browse files Browse the repository at this point in the history
…disabled)

related to: Oldes/Rebol-issues#1619
  • Loading branch information
Oldes committed Oct 9, 2020
1 parent 88b7f92 commit c563d42
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/core/p-clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@
return R_RET;

case A_WRITE:
if (!IS_STRING(arg) && !IS_BINARY(arg)) Trap1(RE_INVALID_PORT_ARG, arg);
if (!(IS_STRING(arg) || IS_BINARY(arg))) {
#ifdef WRITE_ANY_VALUE_TO_CLIPBOARD
REB_MOLD mo = {0};
Reset_Mold(&mo);
Mold_Value(&mo, arg, TRUE);
Set_String(arg, mo.series);
#else
Trap1(RE_INVALID_PORT_ARG, arg);
#endif
}
// This device is opened on the WRITE:
if (!IS_OPEN(req)) {
if (OS_DO_DEVICE(req, RDC_OPEN)) Trap_Port(RE_CANNOT_OPEN, port, req->error);
Expand Down

0 comments on commit c563d42

Please sign in to comment.