[nautilus] location-entry: Play bell when tab-complete fails



commit ede38fd1a4b5d66733e078a301e9b94e9ceec743
Author: James Westman <james jwestman net>
Date:   Thu Feb 11 14:12:09 2021 -0600

    location-entry: Play bell when tab-complete fails
    
    When you press Tab in the location entry and there's no autocomplete
    suggestion, play an error bell instead of closing the location entry.
    
    Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1171

 src/nautilus-location-entry.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index f47c32c97..e204d5bc5 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -649,12 +649,19 @@ nautilus_location_entry_on_event (GtkWidget *widget,
      * should position the insertion point at the end of
      * the selection.
      */
-    if (keyval == GDK_KEY_Tab && selected)
+    if (keyval == GDK_KEY_Tab && !(state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)))
     {
-        int position;
+        if (selected)
+        {
+            int position;
 
-        position = strlen (gtk_entry_get_text (GTK_ENTRY (editable)));
-        gtk_editable_select_region (editable, position, position);
+            position = strlen (gtk_entry_get_text (GTK_ENTRY (editable)));
+            gtk_editable_select_region (editable, position, position);
+        }
+        else
+        {
+            gtk_widget_error_bell (GTK_WIDGET (entry));
+        }
 
         return GDK_EVENT_STOP;
     }


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