Merge pull request #2861 from rcorre/bind-completion-fix
Fix bind completion for bindings with arguments.
This commit is contained in:
commit
210bc0fd6b
@ -126,11 +126,12 @@ def bind(key):
|
|||||||
key: the key being bound.
|
key: the key being bound.
|
||||||
"""
|
"""
|
||||||
model = completionmodel.CompletionModel(column_widths=(20, 60, 20))
|
model = completionmodel.CompletionModel(column_widths=(20, 60, 20))
|
||||||
cmd_name = objreg.get('key-config').get_bindings_for('normal').get(key)
|
cmd_text = objreg.get('key-config').get_bindings_for('normal').get(key)
|
||||||
|
|
||||||
if cmd_name:
|
if cmd_text:
|
||||||
|
cmd_name = cmd_text.split(' ')[0]
|
||||||
cmd = cmdutils.cmd_dict.get(cmd_name)
|
cmd = cmdutils.cmd_dict.get(cmd_name)
|
||||||
data = [(cmd_name, cmd.desc, key)]
|
data = [(cmd_text, cmd.desc, key)]
|
||||||
model.add_category(listcategory.ListCategory("Current", data))
|
model.add_category(listcategory.ListCategory("Current", data))
|
||||||
|
|
||||||
cmdlist = _get_cmd_completions(include_hidden=True, include_aliases=True)
|
cmdlist = _get_cmd_completions(include_hidden=True, include_aliases=True)
|
||||||
|
@ -583,7 +583,7 @@ def test_bind_completion(qtmodeltester, monkeypatch, stubs, config_stub,
|
|||||||
_patch_cmdutils(monkeypatch, stubs,
|
_patch_cmdutils(monkeypatch, stubs,
|
||||||
'qutebrowser.completion.models.miscmodels.cmdutils')
|
'qutebrowser.completion.models.miscmodels.cmdutils')
|
||||||
config_stub.data['aliases'] = {'rock': 'roll'}
|
config_stub.data['aliases'] = {'rock': 'roll'}
|
||||||
key_config_stub.set_bindings_for('normal', {'s': 'stop',
|
key_config_stub.set_bindings_for('normal', {'s': 'stop now',
|
||||||
'rr': 'roll',
|
'rr': 'roll',
|
||||||
'ro': 'rock'})
|
'ro': 'rock'})
|
||||||
model = miscmodels.bind('s')
|
model = miscmodels.bind('s')
|
||||||
@ -593,14 +593,14 @@ def test_bind_completion(qtmodeltester, monkeypatch, stubs, config_stub,
|
|||||||
|
|
||||||
_check_completions(model, {
|
_check_completions(model, {
|
||||||
"Current": [
|
"Current": [
|
||||||
('stop', 'stop qutebrowser', 's'),
|
('stop now', 'stop qutebrowser', 's'),
|
||||||
],
|
],
|
||||||
"Commands": [
|
"Commands": [
|
||||||
('drop', 'drop all user data', ''),
|
('drop', 'drop all user data', ''),
|
||||||
('hide', '', ''),
|
('hide', '', ''),
|
||||||
('rock', "Alias for 'roll'", 'ro'),
|
('rock', "Alias for 'roll'", 'ro'),
|
||||||
('roll', 'never gonna give you up', 'rr'),
|
('roll', 'never gonna give you up', 'rr'),
|
||||||
('stop', 'stop qutebrowser', 's'),
|
('stop', 'stop qutebrowser', ''),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user