Bug 174562

Summary: Selection in konsole is not cleared when another application takes over the selection buffer.
Product: [Applications] konsole Reporter: Klaus S. Madsen <kde>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED NOT A BUG    
Severity: wishlist CC: robertknight
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Implement the feature
When selecting, remove the selection from other windows from the same process

Description Klaus S. Madsen 2008-11-07 20:38:55 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

I've just started using konsole (having used rxvt for quite a while), and unlike rxvt and other applications (like e.g. konqueror), the selection in konsole isn't cleared when another application takes over the selection buffer (e.g. by selecting something in another konsole window).

I don't know if this is intentional,  but it annoyed me enough that I've written a patch to fix this, which will be attached shortly.

I've implemented the clearing of the selection in the TerminalWindow class, as this is also the class that takes care of informing the Screen and ScreenWindow classes of mouse-initiated selection changes, so I hope that I haven't violated the MVC hierarchy.
Comment 1 Klaus S. Madsen 2008-11-07 20:41:39 UTC
Created attachment 28399 [details]
Implement the feature

Btw, it's the TerminalDisplay class, not TerminalWindow.
Comment 2 Robert Knight 2008-11-07 20:53:44 UTC
Patch looks good.  Will commit shortly.
Comment 3 Klaus S. Madsen 2008-11-08 02:41:26 UTC
Unfortunately I discovered a problem with the patch. It only handles the case where it is another process that takes over the selection. But when konsole is started from the menu instead of from the command line, the same konsole process is reused, and another window is added. The same is true when using tabs.

So in these cases the the selection isn't cleared, when a new selection is made in e.g. another tab of the same konsole.

I'm working on a patch to solve this, but it pretty late here, and it doesn't work currently, so it'll have to wait until tomorrow.
Comment 4 Klaus S. Madsen 2008-11-08 16:33:10 UTC
Created attachment 28416 [details]
When selecting, remove the selection from other windows from the same process

This is patch handles the in-process selection clearing, that the first patch doesn't handle. Both should be applied in order to have the selection cleared when a new selection is made.

Again, the patch is against SVN trunk.
Comment 5 Kurt Hindenburg 2009-04-28 16:51:47 UTC
Example:
 1. Highlight A in tab 1
 2. Highlight B in tab 2
 3. Copy/Paste tab1 - get A
 4. Copy/Paste tab2 - get B

Isn't this the way it should be?  I'm not clear on why you want to clear the selections on other sessions.
Comment 6 Klaus S. Madsen 2009-04-29 08:44:23 UTC
It might be by design, I don't know. If it is, it behaves differently that eg. konqueror, kopete and most other programs, which clears the selection when a new selection is made.

It makes sense, as X actually have two ways to copy/paste. The selection buffer, which you use when you copy text by selecting it, and pasting by middle clicking. And the clipboard which is where the text ends up when you actively copy it after selecting (eg. by pressing CTRL+C).

So if the selection is cleared when a new selection is made, you have a visual cue as to what is currently in the selection buffer, by simply looking at which text is marked on your screen.

I get caught by this a few times each day, believing that my selection buffer still contains the text I can see is marked in a konsole, even though its been replaced, leading me to paste the wrong text.
Comment 7 Kurt Hindenburg 2010-04-27 05:27:34 UTC
Was there any consensus on how this should be handled in Konsole?
Comment 8 Kurt Hindenburg 2011-01-03 17:41:08 UTC
A few people have mentioned this the current behavior is correct for KDE apps.  

I would tend to agree, selecting text should not clear all the others.

Marking as invalid.

Comment further if you disagree.