From ba11ec8acd066c1bb036cf6be61c4155d076c099 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 14 Jul 2009 23:41:25 +0200 Subject: [PATCH] Open the search engine even if only the token is typed So "g" opens Google while "g cat" uses Google to search for cats. --- midori/sokoke.c | 4 ++-- tests/magic-uri.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index c65918bd..6654eedc 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -363,11 +363,11 @@ sokoke_magic_uri (const gchar* uri, search_uri = NULL; /* Do we have a keyword and a string? */ parts = g_strsplit (uri, " ", 2); - if (parts[0] && parts[1]) + if (parts[0]) if ((item = katze_array_find_token (search_engines, parts[0]))) { search_uri = katze_item_get_uri (item); - search = sokoke_search_uri (search_uri, parts[1]); + search = sokoke_search_uri (search_uri, parts[1] ? parts[1] : ""); } g_strfreev (parts); return search; diff --git a/tests/magic-uri.c b/tests/magic-uri.c index 10f45e8f..a771786d 100644 --- a/tests/magic-uri.c +++ b/tests/magic-uri.c @@ -141,6 +141,7 @@ magic_uri_search (void) test_input ("max@mustermann.de", NULL); test_input ("g max@mustermann.de", NULL); test_input ("g inurl:http://twotoasts.de bug", NULL); + test_input ("sm", SM); } static void