Bug 387662 - copy/paste from KDevelop into qtbugreports.qt.io strips indentation
Summary: copy/paste from KDevelop into qtbugreports.qt.io strips indentation
Status: CLOSED INTENTIONAL
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.38.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-07 11:18 UTC by RJVB
Modified: 2018-08-16 11:37 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
function copy/pasted directly from KDevelop (603 bytes, text/plain)
2017-12-07 11:18 UTC, RJVB
Details
function copied from KDevelop, pasted into Qt's tracker and then copy/pasted here. (437 bytes, text/plain)
2017-12-07 11:19 UTC, RJVB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description RJVB 2017-12-07 11:18:26 UTC
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.
Comment 1 RJVB 2017-12-07 11:19:52 UTC
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.
Comment 2 Christoph Cullmann 2017-12-20 18:55:39 UTC
;=)

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.
Comment 3 Christoph Cullmann 2017-12-20 19:04:51 UTC
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 :/
Comment 4 RJVB 2017-12-20 19:08:54 UTC
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).
Comment 5 Christoph Cullmann 2017-12-20 19:17:35 UTC
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.
Comment 6 RJVB 2017-12-20 19:43:19 UTC
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.
Comment 7 Christoph Cullmann 2017-12-20 20:07:09 UTC
Then you are forced to cope with "you get HTML" on paste for other programs that prefer the HTML variant.
Comment 8 RJVB 2017-12-20 21:42:56 UTC
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.
Comment 9 Christoph Cullmann 2018-08-16 08:53:06 UTC
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.
Comment 10 RJVB 2018-08-16 10:22:19 UTC
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.
Comment 11 RJVB 2018-08-16 11:37:08 UTC
> 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.