After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 353709 - GtkEntry shift-click inside selected text can behave funny
GtkEntry shift-click inside selected text can behave funny
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-08-31 17:44 UTC by Benjamin Otte (Company)
Modified: 2006-12-24 06:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix (989 bytes, patch)
2006-09-01 14:45 UTC, Benjamin Otte (Company)
none Details | Review

Description Benjamin Otte (Company) 2006-08-31 17:44:31 UTC
Since the summary includes the word funny, I'll do a quiz:
You need:
- Epiphany's location bar or a stock GtkEntry
- the text "http://planet.gnome.org" in that entry
- the part "gnome." as the selection in that entry
Question:
- If you wanted to not select the dot, how would you do that?

There's 2 solutions to this (which is the reason for this bug).

Fast, but unreliable solution: shift-click before the dot to unselect it
Slow, but reliable solution: select "gnome"

Why is the first solution unreliable?
Because when you shift-click inside the selection, the selection will "end" where you clicked. But if you selected the text backwards by clicking on the dot and dragging to the g, the shift-click will result in only having the "." selected.

My solution to this would be to always leave the bigger part selected, where I'd define "bigger" as "contains more bytes".
This would also allow to use shift-click on both sides if one had accidently selected ".gnome." but wanted to select "gnome".
Comment 1 Behdad Esfahbod 2006-08-31 20:41:57 UTC
It's actually worse in textview.  In gedit for example, shift+clicking in the middle of the selection removes the selection completely.

I agree that it should leave the bigger part of the selection intact.  I marginally prefer a better metric for "bigger", like number of characters (or better yet, width), but that can be tweaked later.
Comment 2 Benjamin Otte (Company) 2006-09-01 14:45:29 UTC
Created attachment 72020 [details] [review]
fix

Here's a fix for GtkEntry.
Comment 3 Matthias Clasen 2006-12-24 06:33:36 UTC
2006-12-24  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkentry.c (gtk_entry_button_press): When
        shift-clicking, keep the larger part of the selection
        selected.  (#353709, Benjamin Otte)