From c37edf6ed469e36d2e75f9a25dec3e656bb0c02e Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Sun, 17 May 2009 22:42:32 +0100 Subject: [PATCH] Added an optional param to toggle_insert_mode, which allows to specify whether to enable or disable it. --- README | 3 ++- examples/configs/sampleconfig | 2 +- examples/configs/sampleconfig-dev | 2 +- uzbl.c | 11 ++++++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README b/README index bdfb403..733d4c8 100644 --- a/README +++ b/README @@ -161,7 +161,8 @@ actions follows: * `exit` * `search ` * `search_reverse ` -* `toggle_insert_mode` +* `toggle_insert_mode ` + - 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 diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 3cca85c..bca4314 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -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 diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index de60187..ba916cc 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -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 --- 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(); } -- 1.7.9.5