diff options
author | Ryan Roden-Corrent <ryan@rcorre.net> | 2021-05-13 06:29:39 -0400 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-05-18 18:19:21 +0200 |
commit | ca9b17673582950c4c216a128c049901d2ba4a05 (patch) | |
tree | 5a1d7d97d387db4a1e3416623160003db727727a | |
parent | 17c53063a091b754df0cc66c60f72c9dae262b7d (diff) | |
download | qutebrowser-ca9b17673582950c4c216a128c049901d2ba4a05.tar.gz qutebrowser-ca9b17673582950c4c216a128c049901d2ba4a05.zip |
Fix crash in cmd completion for set-cmd-text.
2c4bb064e introduced support for showing bindings in the completion menu
for commands initiated with set-cmd-text. This would crash if given a
binding for just 'set-cmd-text' with no args.
Fixes #6453.
(cherry picked from commit a36efcf6b5b08666c2a65f8d2eef90eaba832fe6)
-rw-r--r-- | qutebrowser/config/config.py | 2 | ||||
-rw-r--r-- | tests/unit/config/test_config.py | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 374019677..69f3ca2cc 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -173,6 +173,8 @@ class KeyConfig: result = results[0] if result.cmd.name != "set-cmd-text": return cmdline + if not result.args: + return None # doesn't look like this sets a command *flags, cmd = result.args if "-a" in flags or "--append" in flags or not cmd.startswith(":"): return None # doesn't look like this sets a command diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index dd6ef54fa..b88bc2f8d 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -211,6 +211,7 @@ class TestKeyConfig: "a": "set-cmd-text no_leading_colon", "b": "set-cmd-text -s -a :skip_cuz_append", "c": "set-cmd-text --append :skip_cuz_append", + "x": "set-cmd-text", }, { "open": ["o"], |