diff options
author | keis <keijser@gmail.com> | 2009-10-13 01:40:41 +0200 |
---|---|---|
committer | keis <keijser@gmail.com> | 2009-10-13 05:11:17 +0200 |
commit | 073131be290fa955b9d8913a5387b07aa297d8f1 (patch) | |
tree | 50353a3249bd9c1dbc240d5a6fa0741ab9f96a5a /examples | |
parent | 1769b555deae08e7bbe9466ff650ef37200e8e4c (diff) |
default values for prompts.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/data/uzbl/scripts/plugins/bind.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/examples/data/uzbl/scripts/plugins/bind.py b/examples/data/uzbl/scripts/plugins/bind.py index 15f6f8e..16c8148 100644 --- a/examples/data/uzbl/scripts/plugins/bind.py +++ b/examples/data/uzbl/scripts/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 = range(4) @@ -158,23 +158,23 @@ 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) self.stack = [] - for glob in split[::2]: + for glob in split[::3]: # Is the binding a MODCMD or KEYCMD: mod_cmd = ismodbind(glob) @@ -239,6 +239,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') @@ -247,6 +248,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) |