From f93cce44561b2475965c91419e72895bc368918e Mon Sep 17 00:00:00 2001 From: keis Date: Sun, 23 Jan 2011 16:59:49 +0100 Subject: disable keycmd reset on mode change * makes history search work * adds new KEYCMD_CLEAR event * configure to clear keycmd on ESCAPE event --- examples/config/config | 1 + examples/data/plugins/bind.py | 3 ++- examples/data/plugins/history.py | 3 +++ examples/data/plugins/keycmd.py | 5 ++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/config/config b/examples/config/config index 4934469..2fea0d7 100644 --- a/examples/config/config +++ b/examples/config/config @@ -172,6 +172,7 @@ set ebind = @mode_bind global,-insert # Resets keycmd and returns to default mode. @on_event ESCAPE @set_mode +@on_event ESCAPE event KEYCMD_CLEAR @bind = event ESCAPE @bind [ = event ESCAPE diff --git a/examples/data/plugins/bind.py b/examples/data/plugins/bind.py index bf693b3..261dc5d 100644 --- a/examples/data/plugins/bind.py +++ b/examples/data/plugins/bind.py @@ -379,7 +379,6 @@ def mode_changed(uzbl, mode): if mode != 'stack': uzbl.bindlet.reset() - uzbl.clear_keycmd() def match_and_exec(uzbl, bind, depth, keylet, bindlet): @@ -470,3 +469,5 @@ def init(uzbl): 'mode_bind': mode_bind, 'bindlet': Bindlet(uzbl), }) + +# vi: set et ts=4: diff --git a/examples/data/plugins/history.py b/examples/data/plugins/history.py index 78a94ce..2ab2ce3 100644 --- a/examples/data/plugins/history.py +++ b/examples/data/plugins/history.py @@ -107,6 +107,7 @@ def history_next(uzbl, _x): def history_search(uzbl, key): uzbl.history.search(key) + uzbl.send('event HISTORY_PREV') uzbl.logger.debug('SEARCH %s %s' % (key, uzbl.history)) end_messages = ('Look behind you, A three-headed monkey!', 'error #4: static from nylon underwear.', 'error #5: static from plastic slide rules.', 'error #6: global warming.', 'error #9: doppler effect.', 'error #16: somebody was calculating pi on the server.', 'error #19: floating point processor overflow.', 'error #21: POSIX compliance problem.', 'error #25: Decreasing electron flux.', 'error #26: first Saturday after first full moon in Winter.', 'error #64: CPU needs recalibration.', 'error #116: the real ttys became pseudo ttys and vice-versa.', 'error #229: wrong polarity of neutron flow.', 'error #330: quantum decoherence.', 'error #388: Bad user karma.', 'error #407: Route flapping at the NAP.', 'error #435: Internet shut down due to maintenance.') @@ -127,3 +128,5 @@ def init(uzbl): # plugin after hook def after(uzbl): uzbl.on_set('keycmd_prompt', lambda uzbl, k, v: uzbl.history.change_prompt(v)) + +# vi: set et ts=4: diff --git a/examples/data/plugins/keycmd.py b/examples/data/plugins/keycmd.py index 2fb2283..928c597 100644 --- a/examples/data/plugins/keycmd.py +++ b/examples/data/plugins/keycmd.py @@ -210,7 +210,7 @@ def modkey_addition_parse(uzbl, modkeys): add_modkey_addition(uzbl, keys[:-1], keys[-1]) -def clear_keycmd(uzbl): +def clear_keycmd(uzbl, *args): '''Clear the keycmd for this uzbl instance.''' k = uzbl.keylet @@ -493,6 +493,7 @@ def init(uzbl): 'KEYCMD_DELETE': keycmd_delete, 'KEYCMD_EXEC_CURRENT': keycmd_exec_current, 'KEYCMD_STRIP_WORD': keycmd_strip_word, + 'KEYCMD_CLEAR': clear_keycmd, 'KEY_PRESS': key_press, 'KEY_RELEASE': key_release, 'MODKEY_ADDITION': modkey_addition_parse, @@ -514,3 +515,5 @@ def init(uzbl): 'set_cursor_pos': set_cursor_pos, 'set_keycmd': set_keycmd, }) + +# vi: set et ts=4: -- cgit v1.2.3