[epiphany/gnome-3-38] find-toolbar: Select pre-filled text in search field



commit 06b7ea761585b3c1dc4e9608115fae0613ad869b
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Jan 15 14:12:35 2021 +0000

    find-toolbar: Select pre-filled text in search field
    
    With commit 809d76e6cfc7 (Pre-fill search field with current selected
    text) focused text from the website will be pre-filled into the search
    entry. This is great, but even though the entry is focused, one cannot
    simply start typing to update the search text.
    
    Improve this user interaction by selecting the pre-filled text.
    
    Related: #809
    
    
    (cherry picked from commit 05276770f63d1b81f778cb66ecca993d37290157)

 embed/ephy-find-toolbar.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/embed/ephy-find-toolbar.c b/embed/ephy-find-toolbar.c
index 34b3d90d9..ff640b28b 100644
--- a/embed/ephy-find-toolbar.c
+++ b/embed/ephy-find-toolbar.c
@@ -645,10 +645,12 @@ ephy_find_toolbar_selection_async (GObject      *source_object,
 
     str_value = jsc_value_to_string (value);
     exception = jsc_context_get_exception (jsc_value_get_context (value));
-    if (exception)
+    if (exception) {
       g_warning ("Error running javascript: %s", jsc_exception_get_message (exception));
-    else if (strlen (str_value))
+    } else if (strlen (str_value)) {
       gtk_entry_set_text (GTK_ENTRY (toolbar->entry), str_value);
+      gtk_editable_select_region (GTK_EDITABLE (toolbar->entry), 0, -1);
+    }
   }
 }
 


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