Kode / Krom

Other
96 stars 23 forks source link

onCut & onCopy write "null" (string) into clipboard if the callback is null #139

Open MoritzBrueckner opened 4 years ago

MoritzBrueckner commented 4 years ago

When using the Krom backend for Kha, "null" is written (as a string) into the clipboard when the cut/copy callbacks are null (which is the default value). Instead, nothing should happen, the current clipboard value should remain.

I tried to localize the problem but I couldn't solve it.

I assumed that some code in Kore or Kinc was wrong and did not handle a null value, but running the VS debugger showed that the JSValueRef arguments of krom_set_cut_copy_paste_callback() are not null, although JSValueRef can hold a null value according to the documentation.

So I tried changing the types of [cut/copy]Listener in System.hx from Void -> String to Null<Void -> String> (also in the definition of notifyOnCutCopyPaste() and in Krom.hx) because compiling with @:nullSafety(Strict) led to warnings. This had no success, only the warnings are gone now.