Add action dehilight, make ESC dehilight
authorDuClare <akarinotengoku@gmail.com>
Tue, 26 May 2009 13:00:51 +0000 (16:00 +0300)
committerDuClare <akarinotengoku@gmail.com>
Tue, 26 May 2009 13:00:51 +0000 (16:00 +0300)
uzbl.c
uzbl.h

diff --git a/uzbl.c b/uzbl.c
index 6fdbf2e..06b296e 100644 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -532,6 +532,7 @@ static struct {char *name; Command command[2];} cmdlist[] =
     { "exit",               {close_uzbl, 0}                },
     { "search",             {search_forward_text, NOSPLIT} },
     { "search_reverse",     {search_reverse_text, NOSPLIT} },
+    { "dehilight",          {dehilight, 0}                 },
     { "toggle_insert_mode", {toggle_insert_mode, 0}        },
     { "runcmd",             {runcmd, NOSPLIT}              },
     { "set",                {set_var, NOSPLIT}          }
@@ -683,6 +684,13 @@ search_reverse_text (WebKitWebView *page, GArray *argv) {
 }
 
 static void
+dehilight (WebKitWebView *page, GArray *argv) {
+    (void) argv;
+    webkit_web_view_set_highlight_text_matches (page, FALSE);
+}
+
+
+static void
 new_window_load_uri (const gchar * uri) {
     GString* to_execute = g_string_new ("");
     g_string_append_printf (to_execute, "%s --uri '%s'", uzbl.state.executable_path, uri);
@@ -1775,6 +1783,7 @@ key_press_cb (GtkWidget* window, GdkEventKey* event)
     if (event->keyval == GDK_Escape) {
         g_string_truncate(uzbl.state.keycmd, 0);
         update_title();
+        dehilight(uzbl.gui.web_view, NULL);
         return TRUE;
     }
 
diff --git a/uzbl.h b/uzbl.h
index 14346fc..81513a1 100644 (file)
--- a/uzbl.h
+++ b/uzbl.h
@@ -394,6 +394,9 @@ static void
 search_reverse_text (WebKitWebView *page, GArray *argv);
 
 static void
+dehilight (WebKitWebView *page, GArray *argv);
+
+static void
 run_js (WebKitWebView * web_view, GArray *argv);
 
 static void