]> git.armaanb.net Git - chorizo.git/commitdiff
Change search prefix to ":/"
authorPeter Hofmann <scm@uninformativ.de>
Fri, 27 Jan 2017 17:15:30 +0000 (18:15 +0100)
committerPeter Hofmann <scm@uninformativ.de>
Fri, 27 Jan 2017 17:15:36 +0000 (18:15 +0100)
I want to change ensure_uri_scheme() so it automatically adds "file://"
if we're dealing with a valid local file path. However, this clashes
with "/" as a search prefix.

CC #27.

CHANGES
browser.c

diff --git a/CHANGES b/CHANGES
index 8a670ee499c25b33aa6ce2713ad69a1c59505755..4ae5130352a752ff1343b76363455b122f278a25 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
 Release history for lariza
 
 next
+  [Changed]
+  - The "search prefix" has been changed from "/" to ":/". This means,
+    in order to search for text in a web page, you now have to enter
+    something like ":/your search term" into the input box.
+
   [Added]
   - An external user-supplied program can be called for the current URI
     or for hyperlinks/images/videos/audio files.
index e0b45c1d9768c09a49065d19e82c667f3978e206..3cf7d608ec55620ada0afaf8ee1a99b5b768554a 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -646,7 +646,7 @@ key_location(GtkWidget *widget, GdkEvent *event, gpointer data)
                                                         c->web_view));
                     return TRUE;
                 case GDK_KEY_k:  /* initiate search (BOTH hands) */
-                    gtk_entry_set_text(GTK_ENTRY(c->location), "/");
+                    gtk_entry_set_text(GTK_ENTRY(c->location), ":/");
                     gtk_editable_set_position(GTK_EDITABLE(c->location), -1);
                     return TRUE;
                 case GDK_KEY_c:  /* reload trusted certs (left hand) */
@@ -669,11 +669,11 @@ key_location(GtkWidget *widget, GdkEvent *event, gpointer data)
                 case GDK_KEY_Return:
                     gtk_widget_grab_focus(c->web_view);
                     t = gtk_entry_get_text(GTK_ENTRY(c->location));
-                    if (t != NULL && t[0] == '/')
+                    if (t != NULL && t[0] == ':' && t[1] == '/')
                     {
                         if (search_text != NULL)
                             g_free(search_text);
-                        search_text = g_strdup(t + 1);  /* XXX whacky */
+                        search_text = g_strdup(t + 2);  /* XXX whacky */
                         search(c, 0);
                     }
                     else if (!keywords_try_search(WEBKIT_WEB_VIEW(c->web_view), t))
@@ -742,7 +742,7 @@ key_web_view(GtkWidget *widget, GdkEvent *event, gpointer data)
                     return TRUE;
                 case GDK_KEY_k:  /* initiate search (BOTH hands) */
                     gtk_widget_grab_focus(c->location);
-                    gtk_entry_set_text(GTK_ENTRY(c->location), "/");
+                    gtk_entry_set_text(GTK_ENTRY(c->location), ":/");
                     gtk_editable_set_position(GTK_EDITABLE(c->location), -1);
                     return TRUE;
                 case GDK_KEY_c:  /* reload trusted certs (left hand) */