Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm in love with Ubuntu, but I really HATE this feature. I am a programmer and it happened a number of times that I introduced a bug because I inadvertently pasted some code which didn't belong there. I still have nightmares from debugging.

And I can't even turn it off in the 'Mouse and Touchpad' window.

I think it's a weird design decision. Most people expect the middle mouse button to map to scrolling. What was rationale behind this decision?

share|improve this question
1  
The middle-button is mapped to pasting when you are in a text field, but mapped to scrolling when not (e.g. on a Firefox page). As Alex L. said, you get used to it quickly. –  Paddy Landau Dec 6 '12 at 15:03
add comment

1 Answer

up vote 8 down vote accepted

The middle mouse button is mapped to paste the current X-selection, which is normally whatever text is selected. This happens because back in the early days of gui's there was disagreement about how copy/paste should work. Some wanted there to be an explicit command to move something into the copy buffer, others wanted whatever was selected to be moved in there automatically. The makers of X11 (way back when these disagreements were still going strong in the 1980's) decided to implement both and make both sides happy, putting mouse-3 to paste the current selection and ctrl-c/ctrl-v for the copy and paste more commonly found today.

As to how to stop it the unfortunate truth is that you cannot without either patching X or disabling the middle-mouse button all together (which can be done by running

xmodmap -e "pointer = 1 25 3 4 5 6 7 8 9" 

or by putting the line pointer = 1 25 3 4 5 6 7 8 9 in your ~/.xmodmap file).

My advice would be stick it out. The X-selection copy functionality is actually quite useful in many places and it is one of those things you quickly get used it.

share|improve this answer
2  
The middle mouse button works very well for copying and pasting in the Terminal, where Ctrl-C and Ctrl-V are replaced with Ctrl-Shift-C and Ctrl-Shift-V. –  user68186 Dec 5 '12 at 21:03
    
I don't calling the middle mouse button functionality "copy and paste". It would be much more accurate to call it "select and paste". The clipboard used by Ctrl-C, Ctrl-V is independent from the buffer used for select, middle mouse button. –  Flimm Dec 6 '12 at 15:03
    
@Flimm The thing is that there is a copy buffer for the middle-mouse button functionality. It contains whatever was the last text selected at all times. –  Alex L. Dec 6 '12 at 15:30
    
@AlexL: There is a buffer, it's just misleading to call it a "copy buffer". It's a "selection buffer", which is independent from the "copy buffer" used by Ctrl-C. You and I know the distinction, but we should be careful with our terminology so as not to confuse new users. –  Flimm Dec 6 '12 at 16:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.