From d09026aa3c9a4e8b4fefc114fb9cf126a454d01f Mon Sep 17 00:00:00 2001 From: keis Date: Fri, 18 Mar 2011 16:15:48 +0100 Subject: Ignored keys don't enter modcmd but works in modcmd * Makes Shift+Insert bind work without breaking normal shift functionality. --- examples/config/config | 2 +- examples/data/plugins/keycmd.py | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'examples') diff --git a/examples/config/config b/examples/config/config index 146d515..8c706df 100644 --- a/examples/config/config +++ b/examples/config/config @@ -322,7 +322,7 @@ set ebind = @mode_bind global,-insert # Start a new uzbl instance from the page in primary selection @cbind 'p = sh 'echo "event REQ_NEW_WINDOW $(xclip -o)" > "$UZBL_FIFO"' # paste primary selection into keycmd at the cursor position -@bind = sh 'echo "event INJECT_KEYCMD $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"' +@bind = sh 'echo "event INJECT_KEYCMD $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"' # Bookmark inserting binds @cbind b_ = sh 'echo `printf "$UZBL_URI %s"` >> "$XDG_DATA_HOME"/uzbl/bookmarks' diff --git a/examples/data/plugins/keycmd.py b/examples/data/plugins/keycmd.py index 5fb7e8a..198b859 100644 --- a/examples/data/plugins/keycmd.py +++ b/examples/data/plugins/keycmd.py @@ -185,7 +185,7 @@ def update_event(uzbl, modstate, k, execute=True): if uzbl.config.get('modcmd_updates', '1') == '1': new_modcmd = ''.join(modstate) + k.get_modcmd() - if not new_modcmd: + if not new_modcmd or not k.is_modcmd: del uzbl.config['modcmd'] elif new_modcmd == modcmd: @@ -235,14 +235,14 @@ def key_press(uzbl, key): k = uzbl.keylet modstate, key = parse_key_event(uzbl, key) - modstate = set([m for m in modstate if not k.key_ignored(m)]) + k.is_modcmd = any(not k.key_ignored(m) for m in modstate) logger.debug('key press modstate=%s' % str(modstate)) - if key.lower() == 'space' and not modstate and k.keycmd: + if key.lower() == 'space' and not k.is_modcmd and k.keycmd: k.keycmd = inject_str(k.keycmd, k.cursor, ' ') k.cursor += 1 - elif not modstate and len(key) == 1: + elif not k.is_modcmd and len(key) == 1: if uzbl.config.get('keycmd_events', '1') != '1': # TODO, make a note on what's going on here k.keycmd = '' @@ -259,9 +259,7 @@ def key_press(uzbl, key): else: if not k.key_ignored('<%s>' % key): modstate.add('<%s>' % key) - - if len(modstate) > 0: - k.is_modcmd = True + k.is_modcmd = True update_event(uzbl, modstate, k) -- cgit v1.2.3