Remove usertypes.Completion.empty.
Completion.empty existed to fill a slot in the old Command.completions interface if the first positional arg had no completions but the second did, as is the case for the `bind` command. Now that `Command.completions` is replaced by `Command.get_pos_arg_info`, this is no longer needed.
This commit is contained in:
parent
c792ffda67
commit
66358e5b0f
@ -27,8 +27,7 @@ Module attributes:
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
from qutebrowser.completion.models import (miscmodels, urlmodel, configmodel,
|
from qutebrowser.completion.models import miscmodels, urlmodel, configmodel
|
||||||
base)
|
|
||||||
from qutebrowser.utils import objreg, usertypes, log, debug
|
from qutebrowser.utils import objreg, usertypes, log, debug
|
||||||
from qutebrowser.config import configdata
|
from qutebrowser.config import configdata
|
||||||
|
|
||||||
@ -115,13 +114,6 @@ def init_session_completion():
|
|||||||
_instances[usertypes.Completion.sessions] = model
|
_instances[usertypes.Completion.sessions] = model
|
||||||
|
|
||||||
|
|
||||||
def _init_empty_completion():
|
|
||||||
"""Initialize empty completion model."""
|
|
||||||
log.completion.debug("Initializing empty completion.")
|
|
||||||
if usertypes.Completion.empty not in _instances:
|
|
||||||
_instances[usertypes.Completion.empty] = base.BaseCompletionModel()
|
|
||||||
|
|
||||||
|
|
||||||
INITIALIZERS = {
|
INITIALIZERS = {
|
||||||
usertypes.Completion.command: _init_command_completion,
|
usertypes.Completion.command: _init_command_completion,
|
||||||
usertypes.Completion.helptopic: _init_helptopic_completion,
|
usertypes.Completion.helptopic: _init_helptopic_completion,
|
||||||
@ -133,7 +125,6 @@ INITIALIZERS = {
|
|||||||
usertypes.Completion.quickmark_by_name: init_quickmark_completions,
|
usertypes.Completion.quickmark_by_name: init_quickmark_completions,
|
||||||
usertypes.Completion.bookmark_by_url: init_bookmark_completions,
|
usertypes.Completion.bookmark_by_url: init_bookmark_completions,
|
||||||
usertypes.Completion.sessions: init_session_completion,
|
usertypes.Completion.sessions: init_session_completion,
|
||||||
usertypes.Completion.empty: _init_empty_completion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,7 +152,6 @@ class KeyConfigParser(QObject):
|
|||||||
|
|
||||||
@cmdutils.register(instance='key-config', maxsplit=1, no_cmd_split=True)
|
@cmdutils.register(instance='key-config', maxsplit=1, no_cmd_split=True)
|
||||||
@cmdutils.argument('win_id', win_id=True)
|
@cmdutils.argument('win_id', win_id=True)
|
||||||
@cmdutils.argument('key', completion=usertypes.Completion.empty)
|
|
||||||
@cmdutils.argument('command', completion=usertypes.Completion.command)
|
@cmdutils.argument('command', completion=usertypes.Completion.command)
|
||||||
def bind(self, key, win_id, command=None, *, mode='normal', force=False):
|
def bind(self, key, win_id, command=None, *, mode='normal', force=False):
|
||||||
"""Bind a key to a command.
|
"""Bind a key to a command.
|
||||||
|
@ -238,8 +238,7 @@ KeyMode = enum('KeyMode', ['normal', 'hint', 'command', 'yesno', 'prompt',
|
|||||||
# Available command completions
|
# Available command completions
|
||||||
Completion = enum('Completion', ['command', 'section', 'option', 'value',
|
Completion = enum('Completion', ['command', 'section', 'option', 'value',
|
||||||
'helptopic', 'quickmark_by_name',
|
'helptopic', 'quickmark_by_name',
|
||||||
'bookmark_by_url', 'url', 'tab', 'sessions',
|
'bookmark_by_url', 'url', 'tab', 'sessions'])
|
||||||
'empty'])
|
|
||||||
|
|
||||||
|
|
||||||
# Exit statuses for errors. Needs to be an int for sys.exit.
|
# Exit statuses for errors. Needs to be an int for sys.exit.
|
||||||
|
@ -112,7 +112,6 @@ def cmdutils_patch(monkeypatch, stubs):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@cmdutils.argument('win_id', win_id=True)
|
@cmdutils.argument('win_id', win_id=True)
|
||||||
@cmdutils.argument('key', completion=usertypes.Completion.empty)
|
|
||||||
@cmdutils.argument('command', completion=usertypes.Completion.command)
|
@cmdutils.argument('command', completion=usertypes.Completion.command)
|
||||||
def bind(key, win_id, command=None, *, mode='normal', force=False):
|
def bind(key, win_id, command=None, *, mode='normal', force=False):
|
||||||
"""docstring!"""
|
"""docstring!"""
|
||||||
@ -171,10 +170,10 @@ def _validate_cmd_prompt(cmd, txt):
|
|||||||
(':help |', usertypes.Completion.helptopic),
|
(':help |', usertypes.Completion.helptopic),
|
||||||
(':help |', usertypes.Completion.helptopic),
|
(':help |', usertypes.Completion.helptopic),
|
||||||
(':open |', usertypes.Completion.url),
|
(':open |', usertypes.Completion.url),
|
||||||
(':bind |', usertypes.Completion.empty),
|
(':bind |', None),
|
||||||
(':bind <c-x> |', usertypes.Completion.command),
|
(':bind <c-x> |', usertypes.Completion.command),
|
||||||
(':bind <c-x> foo|', usertypes.Completion.command),
|
(':bind <c-x> foo|', usertypes.Completion.command),
|
||||||
(':bind <c-x>| foo', usertypes.Completion.empty),
|
(':bind <c-x>| foo', None),
|
||||||
(':set| general ', usertypes.Completion.command),
|
(':set| general ', usertypes.Completion.command),
|
||||||
(':|set general ', usertypes.Completion.command),
|
(':|set general ', usertypes.Completion.command),
|
||||||
(':set gene|ral ignore-case', usertypes.Completion.section),
|
(':set gene|ral ignore-case', usertypes.Completion.section),
|
||||||
|
Loading…
Reference in New Issue
Block a user