GNOME Bugzilla – Bug 353709
GtkEntry shift-click inside selected text can behave funny
Last modified: 2006-12-24 06:33:36 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".
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.
Created attachment 72020 [details] [review] fix Here's a fix for GtkEntry.
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)