/bind with only one argument now resets the binding

This commit is contained in:
mathieui 2012-07-29 19:45:46 +02:00
parent e7837355d1
commit ec7dd75012
2 changed files with 11 additions and 6 deletions

View file

@ -188,10 +188,10 @@ def shell_split(st):
return st.split(" ")
def replace_key_with_bound(key):
if config.has_option('bindings', key):
return config.get(key, key, 'bindings')
else:
return key
bind = config.get(key, key, 'bindings')
if not bind:
bind = key
return bind
def parse_str_to_secs(duration=''):
"""

View file

@ -1945,10 +1945,15 @@ class Core(object):
Bind a key.
"""
args = common.shell_split(arg)
if len(args) != 2:
if len(args) < 1:
return self.command_help('bind')
elif len(args) < 2:
args.append("")
config.set_and_save(args[0], args[1], section='bindings')
self.information('%s is now bound to %s' % (args[0], args[1]), 'Info')
if args[1]:
self.information('%s is now bound to %s' % (args[0], args[1]), 'Info')
else:
self.information('%s is now unbound' % args[0], 'Info')
def command_pubsub(self, args):
"""