[gnome-builder/gnome-builder-3-26] editor: fix (re)selection in editor search entry



commit 94755e6423cf1da36322709f5b37d89dfd6b32af
Author: Christian Hergert <chergert redhat com>
Date:   Fri Sep 29 14:31:22 2017 -0700

    editor: fix (re)selection in editor search entry
    
    If the search entry is already focused, we risk allowing the user to
    overwrite everything they started typing.

 libide/editor/ide-editor-search-bar.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/libide/editor/ide-editor-search-bar.c b/libide/editor/ide-editor-search-bar.c
index 6a0d056..a722253 100644
--- a/libide/editor/ide-editor-search-bar.c
+++ b/libide/editor/ide-editor-search-bar.c
@@ -373,7 +373,11 @@ ide_editor_search_bar_grab_focus (GtkWidget *widget)
 
   g_assert (IDE_IS_EDITOR_SEARCH_BAR (self));
 
-  gtk_widget_grab_focus (GTK_WIDGET (self->search_entry));
+  /* Be careful to not reselect or it can reselect the whole
+   * entry text (causing next character to overwrite).
+   */
+  if (!gtk_widget_has_focus (GTK_WIDGET (self->search_entry)))
+    gtk_widget_grab_focus (GTK_WIDGET (self->search_entry));
 }
 
 static void


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