]> spindle.queued.net Git - midori/commitdiff
No completion when typing token or leading space
authorChristian Dywan <christian@twotoasts.de>
Thu, 27 Oct 2011 17:26:45 +0000 (19:26 +0200)
committerChristian Dywan <christian@twotoasts.de>
Thu, 27 Oct 2011 17:32:17 +0000 (19:32 +0200)
midori/midori-locationaction.c

index 0fc0374a8af778a4222c88bd6b21a36583df44ce..5d9b6ee881aa15cbfddb7a21b448ec32c4a03e41 100644 (file)
@@ -356,7 +356,22 @@ midori_location_action_popup_timeout_cb (gpointer data)
     if (!action->entry || !gtk_widget_has_focus (action->entry) || !action->history)
         return FALSE;
 
-    if (!(action->key && *action->key))
+    /* No completion when typing a search token */
+    if (action->search_engines != NULL)
+    {
+        gchar** parts = g_strsplit (action->key, " ", 2);
+        if (parts && *parts && parts[1]
+                  && katze_array_find_token (action->search_engines, *parts))
+        {
+            g_strfreev (parts);
+            midori_location_action_popdown_completion (action);
+            return FALSE;
+        }
+        g_strfreev (parts);
+    }
+
+    /* Empaty string or starting with a space means: no completion */
+    if (!(action->key && *action->key && *action->key != ' '))
     {
         midori_location_action_popdown_completion (action);
         return FALSE;