Allow ":" as in "foo:bar" to search from the location
This commit is contained in:
parent
744f9ce56f
commit
b9a183c316
2 changed files with 7 additions and 3 deletions
|
@ -114,8 +114,12 @@ sokoke_magic_uri (const gchar* uri,
|
||||||
if (!strstr (uri, "://"))
|
if (!strstr (uri, "://"))
|
||||||
{
|
{
|
||||||
/* Do we have a domain, ip address or localhost? */
|
/* Do we have a domain, ip address or localhost? */
|
||||||
|
search = strchr (uri, ':');
|
||||||
|
if ((search && search[0] && !g_ascii_isalpha (search[1]))
|
||||||
|
|| !strcmp (uri, "localhost"))
|
||||||
|
return g_strconcat ("http://", uri, NULL);
|
||||||
parts = g_strsplit (uri, ".", 0);
|
parts = g_strsplit (uri, ".", 0);
|
||||||
if (parts[0] && parts[1])
|
if (!search && parts[0] && parts[1])
|
||||||
{
|
{
|
||||||
search = NULL;
|
search = NULL;
|
||||||
if (!(parts[1][1] == '\0' && !g_ascii_isalpha (parts[1][0])))
|
if (!(parts[1][1] == '\0' && !g_ascii_isalpha (parts[1][0])))
|
||||||
|
@ -124,8 +128,6 @@ sokoke_magic_uri (const gchar* uri,
|
||||||
if (search)
|
if (search)
|
||||||
return search;
|
return search;
|
||||||
}
|
}
|
||||||
if (strchr (uri, ':') || !strcmp (uri, "localhost"))
|
|
||||||
return g_strconcat ("http://", uri, NULL);
|
|
||||||
/* We don't want to search? So return early. */
|
/* We don't want to search? So return early. */
|
||||||
if (!search_engines)
|
if (!search_engines)
|
||||||
return g_strdup (uri);
|
return g_strdup (uri);
|
||||||
|
|
|
@ -70,6 +70,8 @@ main (int argc,
|
||||||
test_input ("gtk2.0", NULL);
|
test_input ("gtk2.0", NULL);
|
||||||
test_input ("midori0.1.0", NULL);
|
test_input ("midori0.1.0", NULL);
|
||||||
test_input ("midori 0.1.0", NULL);
|
test_input ("midori 0.1.0", NULL);
|
||||||
|
test_input ("search:cats", NULL);
|
||||||
|
test_input ("search:twotoasts.de", NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue