Merge remote-tracking branch 'origin/pr/2953'

This commit is contained in:
Florian Bruhin 2017-09-21 13:43:01 +02:00
commit a559477028
2 changed files with 21 additions and 3 deletions

View File

@ -21,7 +21,7 @@
from qutebrowser.config import configdata, configexc from qutebrowser.config import configdata, configexc
from qutebrowser.completion.models import completionmodel, listcategory, util from qutebrowser.completion.models import completionmodel, listcategory, util
from qutebrowser.commands import cmdutils from qutebrowser.commands import runners
def option(*, info): def option(*, info):
@ -71,8 +71,8 @@ def bind(key, *, info):
cmd_text = info.keyconf.get_command(key, 'normal') cmd_text = info.keyconf.get_command(key, 'normal')
if cmd_text: if cmd_text:
cmd_name = cmd_text.split(' ')[0] parser = runners.CommandParser()
cmd = cmdutils.cmd_dict.get(cmd_name) cmd = parser.parse(cmd_text).cmd
data = [(cmd_text, cmd.desc, key)] data = [(cmd_text, cmd.desc, key)]
model.add_category(listcategory.ListCategory("Current", data)) model.add_category(listcategory.ListCategory("Current", data))

View File

@ -573,6 +573,24 @@ def test_bind_completion(qtmodeltester, cmdutils_stub, config_stub,
}) })
def test_bind_completion_no_current(qtmodeltester, cmdutils_stub, config_stub,
key_config_stub, configdata_stub, info):
"""Test keybinding completion with no current binding. """
model = configmodel.bind('x', info=info)
model.set_pattern('')
qtmodeltester.data_display_may_return_none = True
qtmodeltester.check(model)
_check_completions(model, {
"Commands": [
('open', 'open a url', ''),
('q', "Alias for 'quit'", ''),
('quit', 'quit qutebrowser', 'ZQ, <ctrl+q>'),
('scroll', 'Scroll the current tab in the given direction.', '')
],
})
def test_url_completion_benchmark(benchmark, info, def test_url_completion_benchmark(benchmark, info,
quickmark_manager_stub, quickmark_manager_stub,
bookmark_manager_stub, bookmark_manager_stub,