Update command completion on setting an alias.
Wire up the config change event to update command completion on changing aliases, so the new aliases will be included. Fixes #1814. Currently we do not have tests at a high enough level to test whether signals are wired up correctly to update completions.
This commit is contained in:
parent
245212efa1
commit
91ec5cc356
@ -29,7 +29,7 @@ import functools
|
||||
|
||||
from qutebrowser.completion.models import miscmodels, urlmodel, configmodel
|
||||
from qutebrowser.utils import objreg, usertypes, log, debug
|
||||
from qutebrowser.config import configdata
|
||||
from qutebrowser.config import configdata, config
|
||||
|
||||
|
||||
_instances = {}
|
||||
@ -155,6 +155,12 @@ def update(completions):
|
||||
did_run.append(func)
|
||||
|
||||
|
||||
@config.change_filter('aliases', function=True)
|
||||
def _update_aliases():
|
||||
"""Update completions that include command aliases."""
|
||||
update([usertypes.Completion.command])
|
||||
|
||||
|
||||
def init():
|
||||
"""Initialize completions. Note this only connects signals."""
|
||||
quickmark_manager = objreg.get('quickmark-manager')
|
||||
@ -176,3 +182,5 @@ def init():
|
||||
keyconf = objreg.get('key-config')
|
||||
keyconf.changed.connect(
|
||||
functools.partial(update, [usertypes.Completion.command]))
|
||||
|
||||
objreg.get('config').changed.connect(_update_aliases)
|
||||
|
@ -214,7 +214,7 @@ class TestKeyConfigParser:
|
||||
|
||||
"""Test config.parsers.keyconf.KeyConfigParser."""
|
||||
|
||||
def test_cmd_binding(self, cmdline_test):
|
||||
def test_cmd_binding(self, cmdline_test, config_stub):
|
||||
"""Test various command bindings.
|
||||
|
||||
See https://github.com/The-Compiler/qutebrowser/issues/615
|
||||
@ -222,6 +222,7 @@ class TestKeyConfigParser:
|
||||
Args:
|
||||
cmdline_test: A pytest fixture which provides testcases.
|
||||
"""
|
||||
config_stub.data = {'aliases': []}
|
||||
kcp = keyconf.KeyConfigParser(None, None)
|
||||
kcp._cur_section = 'normal'
|
||||
if cmdline_test.valid:
|
||||
|
Loading…
Reference in New Issue
Block a user