diff options
author | Florian Bruhin <git@the-compiler.org> | 2014-12-11 20:31:26 +0100 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2014-12-11 20:34:38 +0100 |
commit | db4ca495f28e642f61b8fd427028e5e279d9465c (patch) | |
tree | 7e6e339f86d0b85f1426e089912cb6127f9849f4 | |
parent | b7ea8e79790db549037a1b86bf490324e7f9496c (diff) | |
download | qutebrowser-db4ca495f28e642f61b8fd427028e5e279d9465c.tar.gz qutebrowser-db4ca495f28e642f61b8fd427028e5e279d9465c.zip |
Use maxsplit=1 for :bind.
See #233.
-rw-r--r-- | qutebrowser/config/keyconfparser.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/qutebrowser/config/keyconfparser.py b/qutebrowser/config/keyconfparser.py index c5b0e1808..b4c8e3474 100644 --- a/qutebrowser/config/keyconfparser.py +++ b/qutebrowser/config/keyconfparser.py @@ -130,13 +130,13 @@ class KeyConfigParser(QObject): data = str(self) f.write(data) - @cmdutils.register(instance='key-config') - def bind(self, key, *command, mode=None): + @cmdutils.register(instance='key-config', maxsplit=1) + def bind(self, key, command, mode=None): """Bind a key to a command. Args: key: The keychain or special key (inside `<...>`) to bind. - *command: The command to execute, with optional args. + command: The command to execute, with optional args. mode: A comma-separated list of modes to bind the key in (default: `normal`). """ @@ -146,10 +146,12 @@ class KeyConfigParser(QObject): for m in mode.split(','): if m not in configdata.KEY_DATA: raise cmdexc.CommandError("Invalid mode {}!".format(m)) - if command[0] not in cmdutils.cmd_dict: - raise cmdexc.CommandError("Invalid command {}!".format(command[0])) + split_cmd = command.split() + if split_cmd[0] not in cmdutils.cmd_dict: + raise cmdexc.CommandError("Invalid command {}!".format( + split_cmd[0])) try: - self._add_binding(mode, key, ' '.join(command)) + self._add_binding(mode, key, command) except KeyConfigError as e: raise cmdexc.CommandError(e) for m in mode.split(','): |