Clean up command_binding_completion.
- Add a space after the comman for multiple binding suggestions. - Use defaultdict(list) instead of defaultdict(lambda: []) - Move the pylint comment back to the top of the class
This commit is contained in:
parent
52641e25f5
commit
06caee41b8
@ -33,11 +33,11 @@ class CommandCompletionModel(base.BaseCompletionModel):
|
|||||||
|
|
||||||
"""A CompletionModel filled with all commands and descriptions."""
|
"""A CompletionModel filled with all commands and descriptions."""
|
||||||
|
|
||||||
COLUMN_WIDTHS = (20, 60, 20)
|
|
||||||
|
|
||||||
# https://github.com/The-Compiler/qutebrowser/issues/545
|
# https://github.com/The-Compiler/qutebrowser/issues/545
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
|
|
||||||
|
COLUMN_WIDTHS = (20, 60, 20)
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
assert cmdutils.cmd_dict
|
assert cmdutils.cmd_dict
|
||||||
@ -54,11 +54,11 @@ class CommandCompletionModel(base.BaseCompletionModel):
|
|||||||
|
|
||||||
# map each command to its bound keys and show these in the misc column
|
# map each command to its bound keys and show these in the misc column
|
||||||
keyconf = objreg.get('key-config')
|
keyconf = objreg.get('key-config')
|
||||||
cmd_to_keys = defaultdict(lambda: [])
|
cmd_to_keys = defaultdict(list)
|
||||||
for key, cmd in keyconf.get_bindings_for('normal').items():
|
for key, cmd in keyconf.get_bindings_for('normal').items():
|
||||||
cmd_to_keys[cmd].append(key)
|
cmd_to_keys[cmd].append(key)
|
||||||
for (name, desc) in sorted(cmdlist):
|
for (name, desc) in sorted(cmdlist):
|
||||||
self.new_item(cat, name, desc, str.join(',', cmd_to_keys[name]))
|
self.new_item(cat, name, desc, str.join(', ', cmd_to_keys[name]))
|
||||||
|
|
||||||
|
|
||||||
class HelpCompletionModel(base.BaseCompletionModel):
|
class HelpCompletionModel(base.BaseCompletionModel):
|
||||||
|
Loading…
Reference in New Issue
Block a user