Added an optional param to toggle_insert_mode, which allows to specify whether to...
authorBarrucadu <mike@barrucadu.co.uk>
Sun, 17 May 2009 21:42:32 +0000 (22:42 +0100)
committerBarrucadu <mike@barrucadu.co.uk>
Sun, 17 May 2009 21:42:32 +0000 (22:42 +0100)
README
examples/configs/sampleconfig
examples/configs/sampleconfig-dev
uzbl.c

diff --git a/README b/README
index bdfb403..733d4c8 100644 (file)
--- a/README
+++ b/README
@@ -161,7 +161,8 @@ actions follows:
 * `exit`
 * `search <string>`
 * `search_reverse <string>`
-* `toggle_insert_mode`
+* `toggle_insert_mode <optional state>`
+   - if the optional state is 0, disable insert mode. If 1, enable insert mode.
 * `runcmd`
    - can be used for running a command such as SET or BIND
 
index 3cca85c..bca4314 100644 (file)
@@ -77,7 +77,7 @@ bind    o _       = uri %s
 bind    :wiki _   = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go
 bind    gg _      = uri http://www.google.com/search?q=%s
 bind    i         = toggle_insert_mode
-#TODO: no 'toggle' command?
+bind    I         = toggle_insert_mode 0 # disable insert mode (1 to enable)
 bind    B         = spawn /usr/share/uzbl/examples/scripts/insert_bookmark.sh
 bind    U         = spawn /usr/share/uzbl/examples/scripts/load_url_from_history.sh
 bind    u         = spawn /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh
index de60187..ba916cc 100644 (file)
@@ -78,7 +78,7 @@ bind    o _       = uri %s
 bind    :wiki _   = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go
 bind    gg _      = uri http://www.google.com/search?q=%s
 bind    i         = toggle_insert_mode
-#TODO: no 'toggle' command?
+bind    I         = toggle_insert_mode 0 # disable insert mode (1 to enable)
 bind    B         = spawn ./examples/scripts/insert_bookmark.sh
 bind    U         = spawn ./examples/scripts/load_url_from_history.sh
 bind    u         = spawn ./examples/scripts/load_url_from_bookmarks.sh
diff --git a/uzbl.c b/uzbl.c
index 2c3f8b3..2b91be1 100644 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -461,7 +461,16 @@ toggle_insert_mode(WebKitWebView *page, const gchar *param) {
     (void)page;
     (void)param;
 
-    uzbl.behave.insert_mode = ! uzbl.behave.insert_mode;
+    if (param != NULL) {
+        if (strcmp (param, "0") == 0) {
+            uzbl.behave.insert_mode = FALSE;
+        } else {
+            uzbl.behave.insert_mode = TRUE;
+        }
+    } else {
+        uzbl.behave.insert_mode = ! uzbl.behave.insert_mode;
+    }
+
     update_title();
 }