Bug 343726 - Konsole is copying text I don't want
Summary: Konsole is copying text I don't want
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: copy-paste (show other bugs)
Version: 3.0.1
Platform: Archlinux Linux
: NOR normal with 211 votes (vote)
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-03 10:39 UTC by Alexander Nestorov
Modified: 2018-02-08 22:12 UTC (History)
28 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Text after copy (3.19 KB, image/png)
2015-02-07 06:42 UTC, Eugene Lopatin
Details
attachment-1622-0.html (1.14 KB, text/html)
2015-08-05 15:36 UTC, Alexander Nestorov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nestorov 2015-02-03 10:39:36 UTC
If I copy something from Konsole and paste it in a Hangouts window, the text I copied is pasted, but the text "Konsole output" is prepended. 

I don't want this behavior. It's annoying and reminds me of those websites that disable right click and fill your clipboard with text you don't want (links to the website itself).

Reproducible: Always
Comment 1 Arjun AK 2015-02-03 14:30:07 UTC
Created attachment 93902 [details]
attachment-1622-0.html

>If I copy something from Konsole and paste it in a Hangouts window, the text I copied is pasted, but the text "Konsole output" is prepended. 

I can't reproduce this. How are you copying the text? Do you face the same issue when pasting to some other application?
Comment 2 Alexander Nestorov 2015-02-03 15:45:47 UTC
I copy it with right click -> copy text.

Certainly, this happens only with Hangouts (I tried Kate, Skype, Konsole itself, Chrome and Firefox).

I'd think Hangouts (the plugin, not the embedded chat in gmail) is making this, but how can that be? Hangouts doesn't have enough capabilities to actually check from where the text is coming from.
Comment 3 Ionuț Leonte 2015-02-06 10:46:15 UTC
I am also seeing this and it's incredibly annoying. Seems to be happening with applications that allow for 'rich text' to be copy-pasted around to maintain formatting. Easily reproducible with Pidgin by copying colored text from Konsole and pasting it into a chat field - I am now getting fully-formatted text being pasted including colors.

I'm using Konsole from KDE 5 (Konsole version 3.0.1 Using KDE Frameworks 5.6.0).
Comment 4 Ionuț Leonte 2015-02-06 10:50:22 UTC
(In reply to Ionuț Leonte from comment #3)
> I am also seeing this and it's incredibly annoying. Seems to be happening
> with applications that allow for 'rich text' to be copy-pasted around to
> maintain formatting. Easily reproducible with Pidgin by copying colored text
> from Konsole and pasting it into a chat field - I am now getting
> fully-formatted text being pasted including colors.
> 
> I'm using Konsole from KDE 5 (Konsole version 3.0.1 Using KDE Frameworks
> 5.6.0).

Forgot to mention: only the 'rich text' version of the copied data seems to have 'Konsole output'  added. Again using my Pidgin example above, if I right-click the chat field and use 'Paste as plain text' instead I get only the text that I actually copied from Konsole without anything added to it.
Comment 5 Eugene Lopatin 2015-02-07 06:42:24 UTC
Created attachment 90960 [details]
Text after copy

I'm copiyng from konsole via "Ctrl+shift+c" or via right-click menu (it's doesn't matter) text "eeghechohGoh6od"
 and pasting via "Ctrl+v", or "Shift+insert", or right-click menu (doesn't matter) - and it's looks like this.
Comment 6 Rob 2015-04-13 23:18:42 UTC
Possibly related, and this has been bugging me for a while: After upgrading from Konsole 2.x to 3.x, dragging a link from Chromium to konsole shows the link text instead of the link target (URL).

Steps to reproduce:
1. Open Chromium and visit any website.
2. Open Konsole.
3. Drag any link (e.g. the favicon in the omnibox, or a link in the page) from Chromium, and drop it at Konsole.

Before (2.x): A contextmenu appears, and I can choose to "copy", "link" or paste the dropped link target. E.g. https://bugs.kde.org/show_bug.cgi?id=343726

After (3.x): The link text is pasted. For example, if I drag the URL of this page from Chromium 41.0.2272.77 (and 39.0.2171.71) to Konsole 3.0.1, I get the following (note the lot of null bytes, it seems to be a urlencoded UTF-16-encoded string).

'' '%00B%00u%00g%00 %003%004%003%007%002%006%00 %00%13  %00K%00o%00n%00s%00o%00l%00e%00 %00i%00s%00 %00c%00o%00p%00y%00i%00n%00g%00 %00t%00e%00x%00t%00 %00I%00 %00d%00o%00n%00'\''%00t%00 %00w%00a%00n%00t'
Comment 7 Mathias Tillman 2015-04-30 12:22:52 UTC
I looked into the code, and saw that TerminalCharacterDecoder.cpp is responsible for what the copied text contains, Basically, that text is in HTML, with a title tag that says "Konsole output". I'm not sure why a title tag would be required there, so I tried removing it from the code, and that seems to have fixed it.
Comment 8 Mathias Tillman 2015-04-30 12:36:50 UTC
Added Kurt Hindenburg to the CC list as he was the one who committed the HTML related code (http://quickgit.kde.org/?p=konsole.git&a=commit&h=a4aa495c75bad7e2790899678a06fc714b086534).
Comment 9 Philipp A. 2015-05-08 08:22:13 UTC
yeah so it gets a title tag containing “Konsole output”

how is the specification of rich text copying? should it be a full document or just a fragment?

if full document, we’re doing the right thing, and hangouts/thunderbird/… are in the wrong

if fragment, we should just revert that commit, because before it, we did emit a fragment.

---

what i think: the unified handling of “Save as” and “Ctrl+C” is at fault.

“Save as” should wrap it in a whole HTML document, “Ctrl+C” should only copy a fragment.
Comment 10 Matteo Croce 2015-05-08 10:37:35 UTC
I've managed to workaround it by erasing the string "<title>Konsole output</title>" in  /usr/lib/x86_64-linux-gnu/libkonsoleprivate.so.3.0.1 with an hex editor
Comment 11 Jacob Welsh 2015-06-01 21:45:00 UTC
Also happens when just using the cut buffer (select + middle click), with Pidgin. Should that really be using rich text in the first place?
Comment 12 Dane 2015-06-17 07:25:31 UTC
Can confirm this also happens on Fedora 22.
Comment 13 Ed Greshko 2015-06-17 10:08:30 UTC
This is a very annoying problem as it causes grief when pasting text into T-Bird.  I had filed a BZ on this as https://bugs.kde.org/show_bug.cgi?id=349261 but I think it is probably the same issue.
Comment 14 Paul Mansfield 2015-06-22 16:46:28 UTC
This problem started happening to me when I upgraded to KUbuntu 15.04 - click/drag to select text in Konsole and then middle mouse in, say, pidgin chat text and I get "Konsole output" prepended to the text.
Googled for a solution, found this page.
Comment 15 kdebugs 2015-06-23 08:22:38 UTC
I can confirm this and I cannot emphasize enough how annoying this is. Please disable this or make it configurable!

I do not want formatted/HTML/prefixed text when I copy something from the console. This just interrupts so many workflows.
Comment 16 Jacob Welsh 2015-07-21 14:52:57 UTC
Workaround for this and #343321 on Fedora 22:
dnf erase konsole5 && dnf install konsole
Comment 17 Débora 2015-08-03 20:30:18 UTC
Just confirming that this also happens to me (Version 3.0.1 Using KDE Frameworks 5.9.0). Would be awesome if it could be disabled.
Comment 18 pdf 2015-08-05 02:18:28 UTC
This has bit me so many times.  It's quite dangerous if you need to paste something from konsole into an application that expects a fragment (which seems to be everything), and some business logic processes the test - now you've broken something.  To be perfectly honest though, I can't fathom why it would ever be a good idea to copy rich text from the terminal anyway - generally I specifically *don't* want any extra wacky formatting cruft being added to my terminal output when I copy it, regardless of where I'm going to paste it.

All that said, if the world expects something else, it's not practical to suddenly break the world because you're technically right (I don't know or care who is technically right in their implementation(s) here).

So, if Konsole is going to continue copying as rich text (I wish it wouldn't), it doesn't matter whether or not Konsole is technically right, this behaviour should be reverted to producing a fragment.
Comment 19 Shawn Starr 2015-08-05 04:20:42 UTC
Please revert this git commit or provide an option to disable rich text copying mode.
Comment 20 joshchia 2015-08-05 05:04:40 UTC
When I Ctrl-v into Pidgin, I get the weird 'Konsole ...', when I Ctrl-Shift-v into Pidgin or Ctrl-v into Chrome, I get normal content. Maybe something got lost in translation in the clipboard so that somehow Chrome is not affected by pidgin is.
Comment 21 pdf 2015-08-05 05:45:11 UTC
(In reply to joshchia from comment #20)
> When I Ctrl-v into Pidgin, I get the weird 'Konsole ...', when I
> Ctrl-Shift-v into Pidgin or Ctrl-v into Chrome, I get normal content. Maybe
> something got lost in translation in the clipboard so that somehow Chrome is
> not affected by pidgin is.

Chrome simply doesn't support rich-text paste in that case.
Comment 22 Shawn Starr 2015-08-05 15:14:28 UTC
Here's the thing, if there is enough people complaining, i'll revert the git commit until we have a proper solution in place.
Comment 23 Alexander Nestorov 2015-08-05 15:36:27 UTC
The important thing to know here is what exactly is supposed to do the
mentioned commit? Is the behavior in this bug the only thing that is
supposed to do? If yes, then I'd say you should revert it. If no, what are
the benefits of keeping it? What applications/use cases need this feature?

El mié, 5 de agosto de 2015 17:14, Shawn Starr <shawn.starr@rogers.com>
escribió:

> https://bugs.kde.org/show_bug.cgi?id=343726
>
> --- Comment #22 from Shawn Starr <shawn.starr@rogers.com> ---
> Here's the thing, if there is enough people complaining, i'll revert the
> git
> commit until we have a proper solution in place.
>
> --
> You are receiving this mail because:
> You reported the bug.
> You are on the CC list for the bug.
>
Comment 24 Paul Mansfield 2015-08-05 16:31:18 UTC
count me as a complainer. as a sysadmin I do a lot of copy/pasting from terminals, and this "feature" is 99% bug to me.
Comment 25 Débora 2015-08-10 12:19:21 UTC
Count me in as a complainer too! +1 @Paul Mansfield
Comment 26 pdf 2015-08-10 13:24:27 UTC
(In reply to Shawn Starr from comment #22)
> Here's the thing, if there is enough people complaining, i'll revert the git
> commit until we have a proper solution in place.

How many is enough?  I'm sure I can go find some people to complain if that's what's necessary :-/
Comment 27 lumetili 2015-08-12 11:40:01 UTC
Yeah I just got bitten by this.

Start composing mail in Thunderbird, change it to plain text format. Paste text in from Konsole. Only the normal paste is visible. Send the message. The sent message will include the header "Konsole output" before the paste even though it's not visible whilst sending. Nice going Thunderbird too for not converting the editor to plaintext when you're going to send it like that...
Comment 28 Luís Silva 2015-08-13 12:09:46 UTC
+1 @Paul Mansfield
Comment 29 Glenn 2015-08-14 16:15:48 UTC
This finally bugged me enough today to find/submit a bug on it. I deal with a lot of non-linux savvy people that use linux so having in my "run this command `Konsole output....`" and getting "it didn't work, 'Konsole command not found'"... yeah. But thanks for trying to keep us up to date with more advanced coping.
Comment 30 Shawn Starr 2015-08-14 17:09:14 UTC
I've asked the committer for comments, we should have this sorted soon(?)
Comment 31 Kurt Hindenburg 2015-08-15 01:08:35 UTC
I'm working on this - there are a number of things wrong here.
Comment 32 Kurt Hindenburg 2015-08-15 01:58:37 UTC
Git commit 7d22259af621b0fc115e42f263ef5b6a3c7e1c9d by Kurt Hindenburg.
Committed on 15/08/2015 at 01:48.
Pushed by hindenburg into branch 'master'.

Revert "For HTML output, create a full .html file"

This was meant when using File->Save Output->HTML.

However, it has the side effect of making copy/paste Mime(HTML) output
a full HTML page.

This reverts commit a4aa495c75bad7e2790899678a06fc714b086534.

M  +1    -14   src/TerminalCharacterDecoder.cpp

http://commits.kde.org/konsole/7d22259af621b0fc115e42f263ef5b6a3c7e1c9d
Comment 33 Kurt Hindenburg 2015-08-15 02:32:04 UTC
Git commit f14e91b62f4b85ea145b2569d533bcaabc73a0ad by Kurt Hindenburg.
Committed on 15/08/2015 at 02:24.
Pushed by hindenburg into branch 'Applications/15.08'.

Revert "For HTML output, create a full .html file"

This was meant when using File->Save Output->HTML.

However, it has the side effect of making copy/paste Mime(HTML) output
a full HTML page.

This reverts commit a4aa495c75bad7e2790899678a06fc714b086534.

(cherry picked from commit 7d22259af621b0fc115e42f263ef5b6a3c7e1c9d)

M  +1    -14   src/TerminalCharacterDecoder.cpp

http://commits.kde.org/konsole/f14e91b62f4b85ea145b2569d533bcaabc73a0ad
Comment 34 Amichai Rothman 2015-10-15 10:01:16 UTC
Really annoying bug. Happens both with Ctrl-Shift-C and when just highlighting with mouse and pasting with middle button.

So is this just confirmed, or also fixed?

And why on earth is text from a terminal being copied as HTML/rich text in the first place? It's a terminal - nobody cares about colors and fonts. They are actually quite annoying even if the "Konsole Output" prefix wasn't there.

How about just copying the plain text to the clipboard by default? If there's anyone out there that really needs rich text copied from a terminal window, make that a separate Edit/context menu option for them.
Comment 35 ichramm 2015-10-15 13:31:06 UTC
This is fixed on Archlinux (konsole 15.08.1)
Comment 36 John Horne 2018-02-08 22:08:15 UTC
Have to admit a bit surprised to see this bug still open.
It's fixed under Fedora 27 (konsole5-17.12.1-1.fc27.x86_64).
Comment 37 Rex Dieter 2018-02-08 22:12:04 UTC
Thanks for checking, I'll close it then.