In my project, one can do the following steps, which I’m unsure it is the expected behaviour.
In a multiline TextArea, change the LineSpacing (say, to 2);
Type some text, preferably having several lines;
Select all and copy;
Close the window and restart (either recompile the app or re-open another instance of the window), making sure the TextArea keep its default LineSpacing of 1 (e.g. this would be the next time the user uses the application);
Paste.
The pasted text appears much like it was when it was copied, minus the LineSpacing difference.
Now, open TextEdit and paste the same text: the LineSpacing is set accordingly.
I understand there may be cases where one behaviour (or the other) may be wanted, although I guess the way TextEdit works is probably more often expected.
One could store the LineSpacing of the source TextArea in the clipboard, using RawData, but if the user pastes in TextEdit and copy from there, this RawData gets lost anyway.
Strangely, I couldn’t find a related question in Feedback, in this forum or elsewhere on the Internet (searching for Xojo only).
I think the copy-and-paste buffer of an operating system will store limited formatting information when it comes to textual data.
For example, if you copy some formatted text from a webpage, then paste it into MS Word. Word has some built-in capabilities to understand the additional formatting information (in this case HTML) and Word will typically display the formatting similar to how it was in the webpage (but not always, like when pasting an HTML table)
But if you pasted that same HTML formatted text into a simple text editor, like Notepad or a Xojo code window, the copy buffer will automatically remove the formatting information during the paste action and just supply the raw text, because the source and target applications and/or controls don’t have compatible formatting capabilities.
With that said, TextEdit on Mac does understand and accept HTML as well as RTF information. But it could be that the line-spacing part of the formatting is more a characteristic of the control rather than the formatting information of the text. So more than likely the line spacing parts are not compatible or maybe not included in the pasted information at all.
In other words, there will be limits to what copy-and-paste formatting information of text is compatible between applications and controls. I don’t see this necessarily as a Xojo limitation, but rather a compatibility issue between applications. Copy and pasting is just the easiest way to highlight those incompatibilities.
Another example is if you copy the syntax coloured text from a Xojo code window and paste it into TextEdit, the colours are not copied.
Note: the above is just my assumption based on experience.
At Paste time the application where you Paste the data will take utf8, utf16 or Unicode text, thus the differences you can see depending on the application
This is the same that happens with images (with jpg, png, tiff, etc.)
As developer we know far more than the average user who always ask why (s)he cannot paste the Clipboard contents in application <my_application>