This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Smarter middle-click pasting

27

Votes
30
3
Tags: klipper, mouse, middle click klipper, mouse, middle click klipper, mouse, middle click
(comma "," separated)
User avatar
TheBlackCat
Registered Member
Posts
2945
Karma
8
OS

Smarter middle-click pasting

Sat Jul 17, 2010 3:34 am
Currently when you highlight text, it is immediately stored to the clipboard (either a dedicated clipboard or the general clipboard depending on your settings). However, if you highlight some text then middle-click on the highlighted text, the highlighted text is simply replaced with itself. The end result is nothing happens, which makes such functionality pretty useless. Further, it makes it impossible to overwrite text with the middle mouse button.

So my proposal is that if and only if someone highlights text and then presses the middle mouse button on the highlighted text, it pastes the previously-highlighted text instead of the currently highlighted text.

So for example, you have this sentence:
The quick brown fox jumps over the lazy dog


You highlight "quick ", that stores it in the clipboard. Now if you middle click anywhere else, it pastes "quick " there. Let's say you middle-click before "lazy", you get:

The quick brown fox jumps over the quick lazy dog


Now lets say you highlight "dog ". The next thing you do is highlight "fox ". Then you press the middle mouse button somewhere on "fox ". Currently, what would happen is that "fox" is replaced with "fox ", "fox " is stored in the clipboard and the sentence remains the same. Under my proposal, however, "fox " will be replaced with "dog ", "dog " will remain in the clipboard, and the sentence becomes:

The quick brown dog jumps over the quick lazy dog


Now, on the other hand, if you did the same thing, highlighted "dog ", the highlighted "fox ", the middle click anywhere else in the text, "fox " will be pasted not "dog ". Also, if you highlight "fox ", then left-click somewhere else to unhighlight it, then highlight it again, the middle click, it will paste "fox " since the act of unhighlighting the text put "fox " into the clipboard. This should avoid surprises for users.


Man is the lowest-cost, 150-pound, nonlinear, all-purpose computer system which can be mass-produced by unskilled labor.
-NASA in 1965
airdrik
Registered Member
Posts
1854
Karma
5
OS

Smarter middle-click pasting

Mon Jul 19, 2010 6:03 pm
afaik, the middle-click copy-paste is managed by the X server (i.e. a couple levels underneath KDE - KDE doesn't control that behavior nor manage that 'clipboard'. I don't know of any applications which put selections in the KDE clipboard without explicitly copying them), and it isn't designed to be much smarter than: when you middle-click, it pastes whatever is currently (was most recently) selected.

Of course I can understand the obnoxiousness when you want to replace some text with previously selected text (without having to explicitly copy the previous text), it requires you to delete the to-be-replaced text without selecting it before pasting the new text. Another usage is selecting a URL that you want to open in a browser - you have to use alternate means to clear the browser URL bar without selecting that URL in order to paste the previous URL into the bar.

Note: Since the middle-click paste is managed by the X server, it is only available on those platforms. I don't think it is available on Mac, and it isn't available at all on Windows.


airdrik, proud to be a member of KDE forums since 2008-Dec.
onety-three
Registered Member
Posts
37
Karma
0
OS

Smarter middle-click pasting

Mon Jul 19, 2010 6:38 pm
I'm by no means an expert but from what I understand of the system it would be the toolkit's responsibility - and Qt is something that we could theoretically modify (though in practice it wouldn't be too easy to get such an invasive patch in)

It would probably boil down to the application remembering the last selection by itself when new text is selected, putting the new selection into the X buffer and then, on paste, using the text it remembered itself (if it recognizes that the X buffer hasn't been overriden with some other text).

[Edit]
Though it might be impossible to get the buffer content without the actual middle click happening. As I said, I'm no expert.
User avatar
TheBlackCat
Registered Member
Posts
2945
Karma
8
OS

Smarter middle-click pasting

Tue Jul 20, 2010 5:37 am
airdrik wrote:afaik, the middle-click copy-paste is managed by the X server (i.e. a couple levels underneath KDE - KDE doesn't control that behavior nor manage that 'clipboard'. I don't know of any applications which put selections in the KDE clipboard without explicitly copying them), and it isn't designed to be much smarter than: when you middle-click, it pastes whatever is currently (was most recently) selected.

Klipper provides a great deal of control over the clipboard, including allowing for separate or shared clipboards for normal copy/paste and middle click, disabling middle click copy and paste entirely, ignoring certain clipboard contents, manipulating the clipboard contents in arbitrary ways, running commands when certain clipboard contents are detected, and playing back old clipboard items. The paste plasma widget can store arbitrary data to the clipboard without copying anything. So it is certainly within KDE's capability to monitor and manipulate the clipboard.


Man is the lowest-cost, 150-pound, nonlinear, all-purpose computer system which can be mass-produced by unskilled labor.
-NASA in 1965
Rms-Mit
Registered Member
Posts
58
Karma
0
OS

Smarter middle-click pasting

Fri Jul 23, 2010 3:45 am
fit can be done reliably I think It should as it would greatly increase usability of selection pasting and even if it does involve a little work outside of KDE it would greatly benefit all Linux.

the mouse selection pasting is faster most of the time but I end up doing it only the windows way (ctl-X, ctl-V) because of those few times you forget and try it and end up having to start over because you just pasted the wrong thing.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]