diff options
-rw-r--r-- | CHECKLIST | 5 | ||||
-rw-r--r-- | examples/configs/sampleconfig-dev | 4 | ||||
-rw-r--r-- | uzbl.c | 42 |
3 files changed, 46 insertions, 5 deletions
@@ -25,4 +25,7 @@ Also testers and interested people can use this list to see what uzbl is about, * vimlike command and insert modes behave as expected * always_insert_mode and modkey work too * status bar can be toggled on and off, if off, some info (mode) will be put in title bar. position of statusbar (top/bottom) also works - +* backspace erases last edit character +* commands with parameters: any key sequence that ends with underscore _ expects parameter. Undersore marks exact location where parameter begins. Command part can have %s that will be replaced with parameter. + :o _ = uri %s - user needs to type :o www.google.com + :O_ = uri %s - user needs to type :Owww.google.com diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index a1ba48d..e9c9cc1 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -43,6 +43,10 @@ i = insert_mode B = spawn ./examples/scripts/insert_bookmark.sh u = spawn ./examples/scripts/load_url_from_history.sh U = spawn ./examples/scripts/load_url_from_bookmarks.sh +#parameter command examples (all need space but can be removed from individual commands). underscore is important. +o _ = uri %s +:wiki _ = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go +gg _ = uri http://www.google.com/search?q=%s [network] # to start a local socks server, do : ssh -fND localhost:8118 localhost @@ -657,20 +657,52 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) if (insert_mode && event->state != modmask) return FALSE; - if (event->keyval == GDK_Escape) { g_string_truncate(keycmd, 0); - update_title(); + return TRUE; + } + if ((event->keyval == GDK_BackSpace) && (keycmd->len > 0)) { + g_string_truncate(keycmd, keycmd->len - 1); + update_title(); return TRUE; } - g_string_append(keycmd, event->string); + if ((event->keyval == GDK_Return) || (event->keyval == GDK_KP_Enter)) { + GString* short_keys = g_string_new (""); + unsigned int i; + for (i=0; i<(keycmd->len); i++) { + g_string_append_c(short_keys, keycmd->str[i]); + g_string_append_c(short_keys, '_'); + + //printf("\nTesting string: @%s@\n", short_keys->str); + if ((action = g_hash_table_lookup(bindings, short_keys->str))) { + GString* parampart = g_string_new (keycmd->str); + g_string_erase (parampart, 0, i+1); + //printf("\nParameter: @%s@\n", parampart->str); + GString* actionname = g_string_new (""); + if (action->name) + g_string_printf (actionname, action->name, parampart->str); + GString* actionparam = g_string_new (""); + if (action->param) + g_string_printf (actionparam, action->param, parampart->str); + parse_command(actionname->str, actionparam->str); + g_string_free (actionname, TRUE); + g_string_free (actionparam, TRUE); + g_string_free (parampart, TRUE); + g_string_truncate(keycmd, 0); + } + + g_string_truncate(short_keys, short_keys->len - 1); + } + g_string_free (short_keys, TRUE); + return (!insert_mode); + } + g_string_append(keycmd, event->string); if ((action = g_hash_table_lookup(bindings, keycmd->str))) { g_string_truncate(keycmd, 0); - parse_command(action->name, action->param); } @@ -728,6 +760,8 @@ add_binding (const gchar *key, const gchar *act) { if (!parts) return; + //Debug: + printf ("@%s@ @%s@ @%s@\n", key, parts[0], parts[1]); action = new_action(parts[0], parts[1]); g_hash_table_insert(bindings, g_strdup(key), action); |