Created attachment 109232 [details] function copy/pasted directly from KDevelop When I copy a C++ function (attachment 1 [details]) into a form on qtbugreports (like I copied it into the attachment editor here) I end up with attachment 2 [details]. I had to copy the function from Konsole (with the file open in vim) in order for it to paste correctly into Qt's tracker.
Created attachment 109233 [details] function copied from KDevelop, pasted into Qt's tracker and then copy/pasted here. indentation has been lost, other whitespace seems to have been preserved.
;=) Funny, I can reproduce that, is really interesting. I can paste in e.g. this text field, it works, on the https://bugreports.qt.io it doesn't. Perhaps some mime-type stuff set wrong.
Ok, the difference is: We just set the text as "setText" to the clipboard, which IMHO is 'ok'. konsole does in addition do "setHtml" with a HTMLized variant. We have in addition "copy as HTML", which seems not to work as we use "<pre>" and the text field in the qt bugtracker doesn't do newlines there :/
I *think* I did run into an occasion where the result of "copy as HTML" pasted correctly into a QTBUG but then couldn't reproduce it from another machine (or that other machine didn't propose the "copy as HTML" option).
In any case: I don't know how to fix that nicely. If we do always "setHtml", too, you get unwanted 'crap' for some tools that will always paste that part. Actually I think this is more a Jira issue, that it doesn't handle normal text pastes well.
Couldn't you do a setHtml of "html'ified plain text", that is plain text with just a minimal bit of html wrapped around it so it renders exactly the same as plain text would (or should)? If there are tools that give crap with that it's probably because they don't actually handle html correctly, no? "Copy as HTML" would of course still copy what it copies now, I presume that includes syntax highlighting and all.
Then you are forced to cope with "you get HTML" on paste for other programs that prefer the HTML variant.
And would that be a problem? That'd be the case for pasting from Konsole too, no? I could imagine it would be annoying if an application like KMail switches to the rich text editor each time you paste something that also exists as an HTML variant (KMail doesn't do that). I'll try to remember to check how this works out when pasting from QtCreator into a QTBUG report, next time I have to do that anyway.
I think we don't want to change the current behavior. It works well for most cases, I still think it is Jira's fault to not be able to cope with plain text pastes.
Sorry, not resolved :P Why not add a "Copy as Rich Text" action? I can't remember where right now but I'm positive that I've seen such options in other applications.
> Why not add a "Copy as Rich Text" action? Answer: because there's already a "Copy as HTML" action which I never noticed. I'll have to try that one then.