aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/uzbl/plugins/bind.py
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2009-11-03 21:41:51 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2009-11-03 21:41:51 +0800
commitcbee561dbb20bd79a524b29b90802004f78e47d3 (patch)
tree4572c9b503902a6b140f3c6da5e3c8c78a6b0862 /examples/data/uzbl/plugins/bind.py
parent7050a3e097a37df80285aa91b9c3da269e3c8ac9 (diff)
parentf9bb1855e4839675ac39eecbfba77dfffcdf36cb (diff)
Merge branch 'prompt' of git://github.com/keis/uzbl into prompt
Diffstat (limited to 'examples/data/uzbl/plugins/bind.py')
-rw-r--r--examples/data/uzbl/plugins/bind.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/examples/data/uzbl/plugins/bind.py b/examples/data/uzbl/plugins/bind.py
index 8c932be..356b6bd 100644
--- a/examples/data/uzbl/plugins/bind.py
+++ b/examples/data/uzbl/plugins/bind.py
@@ -21,7 +21,7 @@ UZBLS = {}
# Commonly used regular expressions.
starts_with_mod = re.compile('^<([A-Z][A-Za-z0-9-_]*)>')
-find_prompts = re.compile('<([^:>]*):>').split
+find_prompts = re.compile('<([^:>]*):(\"[^>]*\"|)>').split
# For accessing a bind glob stack.
MOD_CMD, ON_EXEC, HAS_ARGS, GLOB, MORE = range(5)
@@ -159,22 +159,22 @@ class Bind(object):
self.bid = self.nextbid()
self.split = split = find_prompts(glob)
- self.prompts = split[1::2]
+ self.prompts = zip(split[1::3],[x.strip('"') for x in split[2::3]])
# Check that there is nothing like: fl*<int:>*
- for glob in split[:-1:2]:
+ for glob in split[:-1:3]:
if glob.endswith('*'):
msg = "token '*' not at the end of a prompt bind: %r" % split
raise BindParseError(msg)
# Check that there is nothing like: fl<prompt1:><prompt2:>_
- for glob in split[2::2]:
+ for glob in split[3::3]:
if not glob:
msg = 'found null segment after first prompt: %r' % split
raise BindParseError(msg)
stack = []
- for (index, glob) in enumerate(reversed(split[::2])):
+ for (index, glob) in enumerate(reversed(split[::3])):
# Is the binding a MODCMD or KEYCMD:
mod_cmd = ismodbind(glob)
@@ -282,6 +282,7 @@ def parse_bind_event(uzbl, args):
def set_stack_mode(uzbl, prompt):
+ prompt,data = prompt
if uzbl.get_mode() != 'stack':
uzbl.set_mode('stack')
@@ -290,6 +291,10 @@ def set_stack_mode(uzbl, prompt):
uzbl.set('keycmd_prompt', prompt)
+ if data:
+ # go through uzbl-core to expand potential @-variables
+ uzbl.send('event SET_KEYCMD %s' % data)
+
def clear_stack(uzbl, mode):
bind_dict = get_bind_dict(uzbl)