[Lazarus] Setting clipboard on Linux adds ending #0

cobines cobines at gmail.com
Thu Mar 8 18:01:14 CET 2012


Hello.

Putting a string to a clipboard is done in TClipboard.SetAsText():

  SetBuffer(PredefinedClipboardFormat(pcfText),s[1],length(Value)+1);

Note that there is length(Value)+1, ending zero included. This comes
from the following revision:

"r7259 | vincents | 2005-06-21 13:42:35 +0200 (wto) | 2 linie

copy terminating #0 to clipboard too, windows expects it."

But some programs on Linux treat this ending zero as part of the
clipboard data. I also checked how a few non-Lazarus programs copy to
clipboard and they don't include ending zero. I don't think it is
needed.

Can adding trailing zero be moved to the win32 widgetset only?

--
cobines



More information about the Lazarus mailing list