aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/uzbl/scripts
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2009-09-22 17:16:49 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2009-09-22 17:16:49 +0800
commit28315daa6ba4096a6a4965ea9f0a706ee521e360 (patch)
tree111b53943e598b1276ca9ac8a64f6b82d62cfd30 /examples/data/uzbl/scripts
parent568e2e24a7bbaf2ba279aaa5ddcd3c25e5902ec8 (diff)
Made modcmd updating optional. Used when in insert mode.
Diffstat (limited to 'examples/data/uzbl/scripts')
-rw-r--r--examples/data/uzbl/scripts/plugins/keycmd.py18
-rw-r--r--examples/data/uzbl/scripts/plugins/mode.py2
2 files changed, 17 insertions, 3 deletions
diff --git a/examples/data/uzbl/scripts/plugins/keycmd.py b/examples/data/uzbl/scripts/plugins/keycmd.py
index 7abb042..4e67a50 100644
--- a/examples/data/uzbl/scripts/plugins/keycmd.py
+++ b/examples/data/uzbl/scripts/plugins/keycmd.py
@@ -17,6 +17,17 @@ _SIMPLEKEYS = {
}
+def keycmd_escape(keycmd):
+ '''Prevent outgoing keycmd values from expanding inside the
+ status_format.'''
+
+ for char in ['\\', '@']:
+ if char in keycmd:
+ keycmd = keycmd.replace(char, '\\'+char)
+
+ return keycmd
+
+
def get_regex(regex):
'''Compiling regular expressions is a very time consuming so return a
pre-compiled regex match object if possible.'''
@@ -139,14 +150,15 @@ def update_event(uzbl, keylet):
if keylet.modcmd:
keycmd = keylet.to_string()
uzbl.event('MODCMD_UPDATE', keylet)
- if keycmd == keylet.to_string():
- config['keycmd'] = keylet.to_string()
+ if 'modcmd_updates' not in config or config['modcmd_updates'] == '1':
+ if keycmd == keylet.to_string():
+ config['keycmd'] = keycmd_escape(keycmd)
elif 'keycmd_events' not in config or config['keycmd_events'] == '1':
keycmd = keylet.cmd
uzbl.event('KEYCMD_UPDATE', keylet)
if keycmd == keylet.cmd:
- config['keycmd'] = keylet.cmd
+ config['keycmd'] = keycmd_escape(keycmd)
def key_press(uzbl, key):
diff --git a/examples/data/uzbl/scripts/plugins/mode.py b/examples/data/uzbl/scripts/plugins/mode.py
index debaba6..f8464e7 100644
--- a/examples/data/uzbl/scripts/plugins/mode.py
+++ b/examples/data/uzbl/scripts/plugins/mode.py
@@ -12,10 +12,12 @@ DEFAULTS = {
'insert': {
'forward_keys': True,
'keycmd_events': False,
+ 'modcmd_updates': False,
'indicator': 'I'},
'command': {
'forward_keys': False,
'keycmd_events': True,
+ 'modcmd_updates': True,
'indicator': 'C'}}}
_RE_FINDSPACES = re.compile("\s+")