diff options
author | David Keijser <keijser@gmail.com> | 2011-05-24 18:21:09 +0200 |
---|---|---|
committer | David Keijser <keijser@gmail.com> | 2011-05-24 18:45:21 +0200 |
commit | 468f35efc44107fc07002638124f63839438aa4c (patch) | |
tree | 860deeaefef1f414158773d5cfecb75119e590a9 /src | |
parent | fc09b334f196b5abd6c6c88f82597e5d6ac71d0e (diff) |
refactor search commands
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.c | 4 | ||||
-rw-r--r-- | src/uzbl-core.c | 11 | ||||
-rw-r--r-- | src/uzbl-core.h | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/commands.c b/src/commands.c index 28a3b39..87e7876 100644 --- a/src/commands.c +++ b/src/commands.c @@ -366,13 +366,13 @@ search_clear(WebKitWebView *page, GArray *argv, GString *result) { void search_forward_text (WebKitWebView *page, GArray *argv, GString *result) { (void) result; - search_text(page, argv, TRUE); + search_text(page, argv_idx(argv, 0), TRUE); } void search_reverse_text(WebKitWebView *page, GArray *argv, GString *result) { (void) result; - search_text(page, argv, FALSE); + search_text(page, argv_idx(argv, 0), FALSE); } void diff --git a/src/uzbl-core.c b/src/uzbl-core.c index d670774..d284859 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -563,17 +563,16 @@ eval_js(WebKitWebView * web_view, const gchar *script, GString *result, const ch } void -search_text (WebKitWebView *page, GArray *argv, const gboolean forward) { - if (argv_idx(argv, 0) && (*argv_idx(argv, 0) != '\0')) { - if (g_strcmp0 (uzbl.state.searchtx, argv_idx(argv, 0)) != 0) { +search_text (WebKitWebView *page, const gchar *key, const gboolean forward) { + if (key && (*key != '\0')) { + if (g_strcmp0 (uzbl.state.searchtx, key) != 0) { webkit_web_view_unmark_text_matches (page); - webkit_web_view_mark_text_matches (page, argv_idx(argv, 0), FALSE, 0); + webkit_web_view_mark_text_matches (page, key, FALSE, 0); g_free (uzbl.state.searchtx); - uzbl.state.searchtx = g_strdup(argv_idx(argv, 0)); + uzbl.state.searchtx = g_strdup (key); } } - if (uzbl.state.searchtx) { if (uzbl.state.verbose) printf ("Searching: %s\n", uzbl.state.searchtx); diff --git a/src/uzbl-core.h b/src/uzbl-core.h index 8e322e6..8108e9a 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -280,7 +280,7 @@ void run_handler(const gchar *act, const gchar *args); void settings_init(); /* Search functions */ -void search_text (WebKitWebView *page, GArray *argv, const gboolean forward); +void search_text (WebKitWebView *page, const gchar *key, const gboolean forward); /* Javascript functions */ void eval_js(WebKitWebView *web_view, const gchar *script, GString *result, const gchar *script_file); |