[gtk+/wip/csoriano/bookmarks: 35/40] gtkentry: only select whole word if no previous bounds



commit a64fab6f5259bfdcc992181bfe3d4273447c88d2
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Apr 21 21:21:56 2015 +0200

    gtkentry: only select whole word if no previous bounds
    
    We were selection the whole word on grabbing focus.
    But that dropped the previous selection if any.
    
    Instead of that, only select the whole word if there were
    no previous selection.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747793

 gtk/gtkentry.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 6668da6..19aac6f 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4993,8 +4993,10 @@ gtk_entry_grab_focus (GtkWidget *widget)
   GtkEntry *entry = GTK_ENTRY (widget);
   GtkEntryPrivate *priv = entry->priv;
   gboolean select_on_focus;
+  gboolean has_selection;
 
-  if (priv->editable && !priv->in_click)
+  has_selection = priv->selection_bound != priv->current_pos;
+  if (priv->editable && !priv->in_click && !has_selection)
     {
       g_object_get (gtk_widget_get_settings (widget),
                     "gtk-entry-select-on-focus",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]