[epiphany/benzea/select-pre-filled-search-text] find-toolbar: Select pre-filled text in search field




commit 56d2b69e912d3c7c07f8793b38db874ae1727619
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Jan 15 15:12:35 2021 +0100

    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

 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]