diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 5f81abe61..b473fee68 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -23,6 +23,11 @@ Added - New `--quiet` argument for the `:debug-pyeval` command to not open a tab with the results. Note `:debug-pyeval` is still only intended for debugging. +Fixed +~~~~~ + +- Fixed completion for various config values when using `:set`. + v0.5.0 ------ diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index bd9af1f33..dbcb13fa5 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -270,7 +270,10 @@ class String(BaseType): "long!".format(self.maxlen)) def complete(self): - return self._completions + if self._completions is not None: + return self._completions + else: + return super().complete() class List(BaseType): diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index d2dd2886b..b746ba035 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -335,6 +335,15 @@ class TestString: def test_complete(self, klass, value): assert klass(completions=value).complete() == value + @pytest.mark.parametrize('valid_values, expected', [ + (configtypes.ValidValues('one', 'two'), + [('one', ''), ('two', '')]), + (configtypes.ValidValues(('1', 'one'), ('2', 'two')), + [('1', 'one'), ('2', 'two')]), + ]) + def test_complete_valid_values(self, klass, valid_values, expected): + assert klass(valid_values=valid_values).complete() == expected + class TestList: