Left-click clears PRIMARY buffer selection (Copy-paste with middle-button/mouse wheel fails)

Bug #34629 reported by Tero Karvinen
126
This bug affects 19 people
Affects Status Importance Assigned to Milestone
GTK+
Invalid
Medium
One Hundred Papercuts
Invalid
Undecided
Unassigned
gtk+2.0 (Ubuntu)
Triaged
Low
Ubuntu Desktop Bugs

Bug Description

Left-click clears the visible selection *and* PRIMARY buffer contents, rather than just clearing the visible selection. This means that a user middle-click pasting finds the text has been dropped and that they can't paste what they expected to paste without going back and reselecting in the previous application again.

1) Select some text.
2) Click somewhere on the document.
3) Click mouse wheel.

Using the PRIMARY mechanism, text should be pasted like it works elsewhere in X. However, nothing is pasted in gedit.

Using the CLIPBOARD mechanism, Ctrl-C, ctrl-V copy-pasting seems to work within gedit, so this is unrelated.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for your bug. Does it work with other applications? The clipboard is an xorg feature so it's likely to be an xorg bug. That's weird because it works fine for me and we didn't get bugs about that

Changed in gedit:
assignee: nobody → desktop-bugs
status: Unconfirmed → Needs Info
Revision history for this message
Tero Karvinen (karvinen+launchpad) wrote :

Copy-pasting with wheel works in other X applications. I guess it is a gedit bug as I have seen it on other systems gedit too.

I just tried it on another computer and on different Ubuntu version (Dapper flight 5) and it has the same bug.

If it works for: did you click somewhere in the document with left mouse button before pasting?

Revision history for this message
Sebastien Bacher (seb128) wrote :

I've just tried that:

- start gedit
- type "some text to gedit"
- double click on text
- middle click after "gedit"
- the text is "some text to gedittext"

works fine for me ... what do you do exactly?

Revision history for this message
Tero Karvinen (karvinen+launchpad) wrote :

This works for me like that too. However, after selecting text, left click on the document background.

> - start gedit
> - type "some text to gedit"
> - double click on text

left click on the document background.

> - middle click after "gedit"

This is what should happen:
> - the text is "some text to gedittext"
But nothing is pasted.

Can you reproduce the bug now?

Revision history for this message
Sebastien Bacher (seb128) wrote :

sure, left click unselect the text and the middle click copy the selection ... I'm not sure that's a bug

Revision history for this message
Tero Karvinen (karvinen+launchpad) wrote :

I am sure it is a bug:
- Copying works in other X programs, even if the original selection is no longer selected (eg. gnome-terminal, firefox).
- Most users are very used to default X copy behavior, many of my students complain there is "something wrong" with gedit copy
- Making copying work without keeping original selected is obviously usefull in some cases. Losing copy buffer is probably never usefull.
Thus, I think gedit should be fixed to work like other gnome and X programs do.

Revision history for this message
Paolo Borelli (pborelli) wrote :

I never noticed this behavior, but now that you point it out I think you are right. I tested with xterm and it behaves like you suggest:

launch two xterm, select something in one, click so that the selection goes away, middle click in the other xterm -> text is pasted

In other words the clipboard should not be cleared when the selection goes away.

Note however that this bug comes from Gtk (GtkTextView widget which gedit uses), not gedit.

Revision history for this message
Sebastien Bacher (seb128) wrote :

I've forwarded the issue upstream: http://bugzilla.gnome.org/show_bug.cgi?id=335221

Changed in gedit:
status: Needs Info → Confirmed
Changed in gtk+2.0:
status: Confirmed → Triaged
Changed in gtk:
status: New → Confirmed
Revision history for this message
Nicolò Chieffo (yelo3) wrote :

Upstream seems too slow on handling this... can Canonical give a hand?
The bug is open since 2007.

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

Let's see if hundredpapercuts will accept this

Revision history for this message
Mat Tomaszewski (mat.t.) wrote :

Use of a middle-click for pasting seems like a power user feature. A papercut bug is something that is likely to affect all users.

Changed in hundredpapercuts:
status: New → Invalid
Revision history for this message
Patrick Conway (patriconway) wrote :

I think that this behavior should be disabled by default for a trackpad, since 'clicking the middle mouse button' = 'bumping the trackpad with one's palm while typing'

Revision history for this message
Lightbreeze (nedhoy-gmail) wrote :

This works fine for me in gedit in Jaunty.
Type some text into gedit > select some text > middle mouse button pastes the selected text as expected.

Revision history for this message
Ryan Thompson (rct86) wrote :

Lightbreeze, the steps to reproduce should be more specific:

1) Select some text, thus copying it to the primary copy-paste-buffer-thingy.
2) *Left* click somewhere on the document, thus clearing the selection.
3) Click mouse wheel (middle click).

Many people (myself included) like to perform step 2 before step 3 as a matter of course, because performing step 2 will place the cursor where you clicked. You can then verify that the cursor ends up exactly where you wanted to paste, before pasting. This avoids having to undo because you pasted one character off.

The problem occurs because GTK applications apparently attempt to synchronize the primary copy-paste-buffer-thingy with the *visible* selection, so that clearing the latter also clears the former. For many people, this synchronization is an unexpected and unwanted behavior, especially because it is not consistent with the behavior of most other (non-GTK) applications.

Revision history for this message
pierre (login-floury) wrote :

yes the bug is very annoying I hope it won't be transformed into a feature.

Revision history for this message
Ronny Rentner (3-launchpad-domains-und-mehr-de) wrote :

I can confirm this bug and I vote to increase the importance. It's very annoying.

It seems like more and more apps are broken in a way that they clear the primary xselection buffer (that's the buffer used for the middle mouse button) after unselecting text.

Broken apps:

Xchat
Claws
Pidgin
Gedit
Openoffice

Working apps:

Gnome Terminal
Firefox

Revision history for this message
Ronny Rentner (3-launchpad-domains-und-mehr-de) wrote :

One more note: It seems like glipper (the Gnome clipboard manager) solves this problem for some apps, eg. when running it, I can paste as expected in Xchat, Claws and Gedit but not in Piding and Openoffice.

Revision history for this message
kalamaster (kalamaster) wrote :

I'm a Debian lenny user 5.0.4 kernel 2.6.26-2-66 Gnome 2.22.3 video nvidia, and I confirm the bug!
Please fix it! I underline the fact that Gedit is the default system user-friendly editor... That's all!
MC

Revision history for this message
Steve Kieu (msh-computing) wrote :

Upgrade to Lucid and noticed the same problem, not only in gedit but also in other gtk2 text widgets (wxwidget which use gtk). No normal X selection / middle mouse to paste behavior.

I guess it is Gtk2 bug

Revision history for this message
Gabriele Vivinetto (gabriele.vivinetto) wrote :

Same behaviour here with 10.04

Changed in gtk:
importance: Unknown → Medium
Revision history for this message
mr. Ed (mred) wrote :

Copy paste fail in others applications how many editors this bug is from gtk and too fail with shortcuts Ctrl-C Ctrl-V

Revision history for this message
Paul Sladen (sladen) wrote :

mr. Ed: Copying-and-pasting with Ctrl-C Ctrl-V (technical term "CLIPBOARD") is completely separate to copying-and-pasting using mouse select and middle-click paste (technical term "PRIMARY").

This bug is that left-click in a window is clearing the selection *and* clearing PRIMARY, rather than just clearing the selection. My original belief on the times that I accidental did this was that I'd just done something wrong, but it does indeed appear to be the application/Gtk+ widgets that are broken in this respect.

description: updated
summary: - Copy-paste with mouse wheel fails
+ Left-click clears PRIMARY buffer selection (Copy-paste with middle-
+ button/mouse wheel fails)
Revision history for this message
MestreLion (mestrelion) wrote :

I have this bug too (on Maverick)

My 2 cents:
- gedit clears the primary *only* if the selection was made on gedit itself! (yes, this seems absurd, i know)

Steps to reproduce:

- Select something in Firefox (double or triple click this very line). Alt+Tab to gedit. Middle-click. Pastes fine
- Left click another part of the text in gedit. Middle-click. Pastes fine

- Select something in gedit (double or triple click) Alt+Tab to firefox. Middle-click. Pastes fine
- Alt+Tab back to gedit. Middle-click anywhere (without left-clicking!). Pastes fine

- Left click another part of the text in gedit. Middle-click. PASTE FAILS
- Alt+tab to firefox. Middle-click. PASTE FAILS

- Select something in Firefox (double or triple click this very line). Alt+Tab to gedit.
- Use keyboard arrow keys to move cursor somewhere else. Middle-click. Pastes fine

- Select something in gedit. Use keyboard arrow keys to move cursor somewhere else. Middle-click. PASTE FAILS
(fails also if you use CTRL+Z or any key that moves the text cursor to another place)

So it looks like the primary is cleared if text cursor in gedit moves (by left-click or arrow keys or any other way) and the selection was made in gedit itself.

Is this behavior the same bug or another, new one?

Revision history for this message
Łukasz Fidosz (virhilo) wrote :

This still occurs in 14.04...

Revision history for this message
Jordan Farrell (feralbytes) wrote :

And still continues to be very annoying... Linux Mint 17.2.

Changed in gtk:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.